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

Re: use a gambas web cgi in a phpBB forum


On Fri, 28 Nov 2025 at 17:06, Lee <t.lee.davidson@xxxxxxxxx> wrote:

> On 11/28/25 4:58 AM, Bruce Steers wrote:
> > The main issue is with phpBB the token {TEXT} is used to insert the text
> but it has line feeds and can't be formatted another
> > way.
>
> Why can't it be formatted another way? Have you tried 'var txt =
> encodeURI("{TEXT}");' ?
>
> >
> > So code like 'var txt = "{TEXT)";
> > Inputs exactly like..
> > var txt = "line 1
> > Line 2
> > Line 3";
> >
> > That would work in a bash script but JavaScript can't do multiline
> strings like that.
>
> A multiline string is just a string with LF characters in it, and
> JavaScript absolutely *can* do multiline strings. The
> following HTML/Javascript code demonstrates that:
>
> [code]
> <!DOCTYPE html>
> <head>
> <style>
>      textarea {
>          border-style: solid;
>          font-size: x-large;
>      }
> </style>
> </head>
> <body>
> <textarea id="raw" cols=10 rows=4></textarea>
> <br><br>
> <textarea id="encoded" cols=30 rows=1></textarea>
> <script>
>      var txt = `Hello\nyou\nbeautiful\nworld!`;
>      document.getElementById("raw").value=txt;
>
>  document.getElementById("encoded").value=encodeURI(document.getElementById("raw").value);
> </script>
> </body>
> </html>
> [/code]
>
> Maybe JavaScript can't do multiline strings the way *you're* trying to do
> it. :-P


no you misunderstand.  it's not me doing it, its the way phpBB token {TEXT}
is replaced.
So in your example above it would result like this..

 var txt = `Hello
you
beautiful
world!`;
So no \n chars in a single line, just actual new lines , so it's a syntax
error in the code it generates.

I've all but given up, this afternoon i found highlight.js and have made a
gambas template from the basic one.
I'm not sure anymore that the way custom bbcode is suitable for a cgi
script the way i wanted to use it.
I'll look into refining the basic highlight script from highlight.js

Thanks though :)
Respects
BruceS

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>