Inferno Web Development
  • Home
  • Forums
  • About
  • Links
  • Contact

Tutorials List

  • C++ Tutorials

Popular Tutorials

All time:

  • Abstract Modeling in Cinema 4D (C4D)
  • C++ Win32 API Tutorial
  • How to Make a Wireframe Render in Cinema 4D (C4D)
  • Upgrade Windows 7 Beta to Windows 7 RC
  • Simple C++ DLL Loading a Message Box

Articles

    • Photoshop
    • Cinema 4D
    • Artificial Intelligence
    • Assembly
    • C#
    • C++ Qt GUI
    • C++ Win32 API
    • C++
    • Java
    • MASM32
    • Windows Tweaks
  • General News
  • Web Development
    • CSS
    • PHP
    • JavaScript

Related Articles

  • PHP Generated Dynamic Images
  • cURL PHP Send POST Data in the Background
  • Anti-Hacking: Securing your passwords!
  • Global Scope
  • PHP IndexOf Key like JavaScript

Programming Tutorials

Home

BBCode GeSHi Filter for MyBB (Syntax Highlighting)

  • Programming
  • C++
  • C++ Qt GUI
  • C++ Win32 API
  • Java
Submitted by Baran Ornarli on Tue, 12/02/2008 - 01:50.
  • PHP

Table of Contents

  1. How GeSHi Filter works

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
5
Average: 5 (1 vote)
»
  • Share Tutorial
  • Login or register to post comments

Navigation

  • Home
  • Forums
  • Image Gallery
  • Links
  • About
  • Contact

Why Register? Contribute articles and tutorials to ID, earn titles, learn from ID programming projects, and advertise your blog in our forums.

  • Forum Community
  • Register Now
  • Write an Article


Copyright © Inferno Development 2008-2009. All Rights Reserved.