miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Master Class miniBB Support Forums / Master Class /   

integration with geshi

Author Anonymous
#1 | Posted: 18 Nov 2007 17:48 
I'm trying to add geshi in the minibb forum.
I allready have a working regex and a function to convert al to geshi.

Now I run into a little problem, beqausse I dont know were to put my codes..

I putted my codes into bb_codes.php, but as far as I know now, this file only handles what goes into the database and comes out into the edit screen, but not in the forums themself.

Since I dont want to waste the database with html garbage, I want to do the geshi parsing when the visitors look at a forum topic....

Where do I put my codes?

I have this so far:


function maak_code( $hlt, $msg)
$geshi = new GeSHi(stripslashes($msg), $hlt);
// $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
return '<div style="border:solid 1px #000000;"><strong>'.$hlt.' code</strong><br /><br />'.$geshi->parse_code().'</div>';

When I put this in bb_codes, it doesnt make any difference (only in the edit screen, there you will finf your formatted code (clean in the database though)

Any help is appreciated.

Author Paul
Lead Developer
#2 | Posted: 19 Nov 2007 03:44 
Since I dont want to waste the database with html garbage...

- So you want to waste server resources, each time converting what is posted on the fly when user loads the page? I would recommend to think deeper until you understand why we use (and why it's useful) another approach.

I suppose geshi is "Generic Syntax Highlighter" so it's more than obvious that you need to put such functions in encodeBB() and decodeBB() of bb_codes.php. However I can't tell you exactly what could be wrong on your side implementing it... custom solutions usually are implemented/investigated by us only for a fee.

Author Anonymous
#3 | Posted: 19 Nov 2007 08:06 
Hi paul, thanks for your input, but I simply cant put it in the database with all the html tags, beqause it wil be like.....imposible, to convert a string like this

<div style="border:solid 1px #ccc; width:500px; overflow:auto;"><h5 style="margin-top:0px; margin-bottom:0px;">actionscript code</h5><pre class="actionscript"><span style="color: #0000ff;">var</span> verhaaltje:<span style="color: #0000ff;">String</span> = <span style="color: #009900;">&quot;Dit is een textje&quot;</span>;

<span style="color: #0000ff;">var</span> format:<span style="color: #0000ff;">TextFormat</span> = <span style="color: #0000ff;">new</span> <span style="color: #0000ff;">TextFormat</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;
format.<span style="color: #000000;">letterSpacing</span> = <span style="color: #000000;">10</span>
veld.<span style="color: #000000;">defaultTextFormat</span> = format

veld.<span style="color: #0000ff;">text</span> = verhaaltje;

back to
var verhaaltje:String = "Dit is een textje";

var format:TextFormat = new TextFormat();
format.letterSpacing = 10
veld.defaultTextFormat = format

veld.text = verhaaltje;

in the edit area.

But I fixed it anyhow (in bb_func_vthreat), as you can see on the


Author Paul
Lead Developer
#4 | Posted: 19 Nov 2007 11:23 
All I can say that converting such code "on-the-fly" when viewing the thread is a wrong solution. Absolutely.

I know it is a very difficult function to provide all the highlighting with possibility to get it back-converted, that's why for miniBB we probably do not still have an easy way (and in general, it is very rarely requested...)

Additionally you would like to use parseMessage() function's routine for converting the message text on the fly, this is a non-core-destructive method.

Author tom322
#5 | Posted: 19 Nov 2007 22:30 
I'm not sure what would be the practical use of "geshi"..

Author Anonymous
#6 | Posted: 20 Nov 2007 10:04 
code highlighting ?

Master Class miniBB Support Forums / Master Class / integration with geshi Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB