Using GeSHi Highlighter with PyroCMS/CodeIgniter - Easy as 1 2 3
Posted: 07-18-2011
Category: PHP Stuff
The easy way to use GeSHi Highlighter with PyroCMS/CodeIgniter.
Step 1: Download latest stable release of GeSHi, currently version 1.0.8.10.
Step 2: Unzip the archive, and copy geshi.php and the geshi folder to your PyroCMS addons/libraries* folder. For CodeIgniter, copy them to your application/libraries folder. You don't need the docs or contrib folders, though you may want to browse through the docs.
Step 3: Load the class file in your controller and then create a new GeSHI object:
// load the library $this->load->library('geshi'); // create a new geshi object $geshi = new GeSHi($source, $language); // parse the code $geshi->parse_code();
That's it! Easy as 1 2 3!
I didn't need to make any modifications to class or file names to get things working. This worked on Ubuntu Linux, so hopefully no one will run into any problems.
For PyroCMS/Codeigniter developers, you can now use the GeSHi library just like any other in your projects. I even created a PyroCMS/CodeIgniter Geshi Helper File for your convenience!
For PyroCMS users, I created a GeSHi Code Highlighter plugin for PyroCMS that you can use in your blog or any other pages.
Hope this makes it easier for everyone to use the GeSHi library with their next PyroCMS/CodeIgniter project!!