Warning: INSERT command denied to user 'dbo292345962'@'74.208.16.27' for table 'watchdog' query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:398:\"INSERT command denied to user 'dbo292345962'@'74.208.16.27' for table 'captcha_sessions'\nquery: INSERT into captcha_sessions (uid, sid, ip_address, timestamp, form_id, solution, status, attempts) VALUES (0, '4011c53c73836e51ff2219ff31df7fca', '23.20.91.134', 1414764313, 'comment_form', '6fe1f2d081b25d3f2bcd4975bad3fe37', 0, 0)\";s:5:\"%file\";s:62:\"/homepages/25/d199835659/htdocs/ID/modules/captcha/captcha.inc\";s:5:\"%line\";i:99;} in /homepages/25/d199835659/htdocs/ID/includes/database.mysql.inc on line 135
BBCode GeSHi Filter for MyBB (Syntax Highlighting) | Inferno Development

BBCode GeSHi Filter for MyBB (Syntax Highlighting)

BB Code Geshi Filter for Code Syntax Highlighting on programming forums, is designed for MyBB Forum 1.4+ (a free forum software).

The BB Code Plugin for MyBB is available as an attachment on this page.

It uses the GeSHi Filter.

You can see the live BB GeSHi Filter demo.

It works very nice, though there seems to be a br problem when there are no line numbers. Tell us on our forums if you have any other problems.

Simply use [code=language] to highlight.

How GeSHi Filter works

include('geshi.php');

$data = "int x = 0;
int main(){
  for(int i = 0; i < 5; i++){
    printf(\"%d\", i);
  }
}"
;
$language = "cpp"; // c++
$geshi = new GeSHi($data, $language);
echo $geshi->parse_code();

This would print the code like so:

int x = 0;
int main(){
  for(int i = 0; i < 5; i++){
    printf("%d", i);
  }
}

There are some ways to enable line numbers, and a couple of other settings in GeSHi documentation.

Update: Version 1.1 has been released, fixing the following:
1.1 --
- Fixed Line number error.
- Fixed spacing/new-line error.
- Fixed padding error.
- Fixed Color scheme to be more natural.
- Fixed parsing errors.

AttachmentSize
BBGeSHi.zip496.95 KB
Anonymous's picture

Can you add wordspacing?

Can you add wordspacing?

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.