Part of the EllisLab Network
   
 
Anyone implemented geshi on their CI projects? Or another syntax highlighter?
Posted: 01 July 2007 02:44 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  353
Joined  03-31-2007

As the title goes…Anyone implemented geshi on their CI projects? Or another syntax highlighter?

Profile
 
 
Posted: 04 September 2008 06:15 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  24
Joined  08-09-2007

I just stumbled accross this posting doing a google search on the subject, its really not hard to do (taken from here):

All you need to do is copy “geshi.php” as well as the “geshi” folder into a new folder “application/plugins/geshi”, and then to create a file “geshi_pi.php” within “application/plugins” with the following content:

<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

function
colorize($source, $language)
{
require_once(APPPATH.'plugins/geshi/geshi.php');
$geshi = new GeSHi(html_entity_decode($source), $language);
$geshi->set_header_type('');
return
$geshi->parse_code();
}
?>

That’s it.  To use it, you need load the plugin with $this->load->plugin(’geshi’) and can then play around with the colorize() function.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 721, on January 06, 2010 09:38 AM
Total Registered Members: 115027 Total Logged-in Users: 64
Total Topics: 122462 Total Anonymous Users: 3
Total Replies: 647374 Total Guests: 490
Total Posts: 769836    
Members ( View Memberlist )