minibb®
Fight the automated spam - protect your miniBB-forums,
getting the Captcha addon! Click here to read more.
Captcha Addon for miniBB
Community Forum
 | Forums | File Bank | Sign Up | Reply | Search | Statistics | Manual |
Master Class miniBB Community Forum / Master Class /

integration with geshi

 
Anonymous
Guest
#1 | Posted: 18 Nov 2007 17:48
Reply 
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:

$pattern[]="~\[code=([^][]+)](.+?)\[/code]~ie";
$replacement[]="maak_code('\\1','\\2')";


function maak_code( $hlt, $msg)
{
$geshi = new GeSHi(stripslashes($msg), $hlt);
$geshi->set_tab_width(2);
// $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_header_type(GESHI_HEADER_DIV);
$geshi->enable_strict_mode(true);
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.
Paul
CEO
#2 | Posted: 19 Nov 2007 03:44
Reply 
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.
Anonymous
Guest
#3 | Posted: 19 Nov 2007 08:06
Reply 
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;
 </pre></div>




back to
[code=actionscript]
var verhaaltje:String = "Dit is een textje";

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

veld.text = verhaaltje;
[/code]


in the edit area.



But I fixed it anyhow (in bb_func_vthreat), as you can see on the http://test.creator.be/index.php?action=vthread&forum=1&topic=3&page=0


regards
Paul
CEO
#4 | Posted: 19 Nov 2007 11:23
Reply 
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.
tom322
Forums Member
#5 | Posted: 19 Nov 2007 22:30
Reply 
I'm not sure what would be the practical use of "geshi"..
Anonymous
Guest
#6 | Posted: 20 Nov 2007 10:04
Reply 
code highlighting ?
 
Your reply
Bold Style  Italic Style  Image Link  URL Link 


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

Before posting, be sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 
Online now: Guests - 37
Members - 0
Most users ever online: 191 [24 Dec 2007 14:33]
Guests - 191 / Members - 0

Forums are powered by miniBB®