[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use a gambas web cgi in a phpBB forum


On 11/28/25 1:10 PM, Lee wrote:
The way I understand how BBCode works in a phpBB forum is: a post, that contains bbcode, is submitted by a user; the content of that post which includes bbcode is POSTed to the server; the PHP is parsed; the bbcode is parsed; and the result is sent back to the user's browser.

That "understanding" is not entirely correct.


I don't see why it couldn't be done the way you originally wanted to, but maybe you've found a way you prefer.

Well, I couldn't let this challenge go.

I installed phpBB3 and added a custom bbcode. It works, except...

TextHighlighter.ToHTML converts linefeeds to the "<br>" tag, as it should. And, they show up in the forum post. (See attached screenshot.) I've tried removing them from the resultant HTML string, but "<br>" tags still show up in the post and the LFs are gone.

If I nest the new "gbcode" bbcode inside a "code" bbcode, the gbcode content is not parsed. If I nest a "code" bbcode inside the "gbcode" bbcode, the code content is not parsed and the BR tags show up as if it is a text content and not code content.

This is the simple cgi web app code I have:
[code]
   Dim sMode As String = "gambas"
   Dim s As String = Read Request.ContentLength

  Print TextHighlighter[sMode].ToHTML(CGI.Decode(s))
[/code]

And here is the code for the "gbcode" ("[gbcode]{TEXT}[/gbcode]") custom bbcode:
<script>document.addEventListener('DOMContentLoaded',function(){const xhr=new XMLHttpRequest();xhr.onload=()=>{if (xhr.readyState==4 && xhr.status==200){document.getElementById("gbcode").innerHTML=xhr.responseText;}};xhr.open("POST","http://localhost/~user/Highlighter.gambas";);xhr.setRequestHeader("Content-Type","text/plain; charset=UTF-8");xhr.send(document.getElementById("gbcode").innerHTML);});</script><span id="gbcode">{TEXT}</span>


I don't know if you're still interested in playing around with this, but, just in case, at least you have something that, somewhat, works.


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----

Attachment: Screenshot_20251129_144718.png
Description: PNG image


Follow-Ups:
Re: use a gambas web cgi in a phpBB forumLee <t.lee.davidson@xxxxxxxxx>
References:
use a gambas web cgi in a phpBB forumBruce Steers <bsteers4@xxxxxxxxx>
Re: use a gambas web cgi in a phpBB forumLee <t.lee.davidson@xxxxxxxxx>
Re: use a gambas web cgi in a phpBB forumBruce Steers <bsteers4@xxxxxxxxx>
Re: use a gambas web cgi in a phpBB forumLee <t.lee.davidson@xxxxxxxxx>
Re: use a gambas web cgi in a phpBB forumBruce Steers <bsteers4@xxxxxxxxx>
Re: use a gambas web cgi in a phpBB forumLee <t.lee.davidson@xxxxxxxxx>