mirror of
https://github.com/bcit-ci/CodeIgniter.git
synced 2025-02-20 11:13:29 +08:00
Version 2.0
parent
d47aa99656
commit
8d424835a5
@ -1,37 +1,21 @@
|
||||
[strong]UPDATE: Version 2.0 - Oct 4, 2011![/strong]
|
||||
|
||||
This article describes a plugin that I wrote that enables GeSHi syntax highlighting in CodeIgniter Sites.
|
||||
|
||||
[h2]What this Is[/h2]
|
||||
[h3]What this Is[/h3]
|
||||
|
||||
This is a plugin (aka "hook") for CodeIgniter that will convert anything between <sourcecode>...</sourcecode> tags to GeSHi-higlighted content. If you're not familiar with GeSHi, you can read more about it at the GeSHi Website ([url]http://qbnz.com/highlighter/[/url]).
|
||||
This is a library (and hook) for CodeIgniter that will convert anything between <sourcecode>...</sourcecode> tags to GeSHi-higlighted content.
|
||||
|
||||
[h2]How to Install[/h2]
|
||||
If you're not familiar with GeSHi, you can read more about it at the GeSHi Website ([url]http://qbnz.com/highlighter/[/url]).
|
||||
|
||||
1. Ensure that [b]$enable_hooks = TRUE;[/b] in your application/config/config.php file.
|
||||
[h3]Download[/h3]
|
||||
|
||||
2. Download the GeShi plugin from [url]http://geshiforci.googlecode.com/files/ci_geshi.zip[/url]
|
||||
[url]https://github.com/downloads/caseyamcl/geshiforci/geshiforci-v2.tar.gz[/url]
|
||||
|
||||
3. Unzip the files, and extract the "geshi_hook.php" file and "geshi" folder to your hooks directory in your application folder. (you may have to create the "hooks" folder if it doesn't already exist)
|
||||
[h3]How to Use It[/h3]
|
||||
|
||||
4. Add the following code to your application/config/hooks.php file:
|
||||
[url]http://caseyamcl.github.com/geshiforci/[/url]
|
||||
|
||||
[code]
|
||||
/* ----------------------------------------------------- */
|
||||
/* -- GeSHi Plugin Hook -- */
|
||||
/* ----------------------------------------------------- */
|
||||
$hook['display_override'] = array(
|
||||
'class' => 'Geshi_hook',
|
||||
'function' => 'run_geshi_filter',
|
||||
'filename' => 'geshi_hook.php',
|
||||
'filepath' => 'hooks',
|
||||
'params' => array('line_numbers_on'));
|
||||
[/code]
|
||||
[h3]More Information[/h3]
|
||||
|
||||
[h2]How to Use[/h2]
|
||||
|
||||
It's simple. Anywhere that you put <sourcecode>...</sourcecode> in your output code (in your view files), this plugin will convert it to <pre class='geshi'>...</pre>, and automatically highlight everything between the tags.
|
||||
|
||||
If you want to specify a language to highlight the code, simply add an attribute to the <sourcecode> tag: <sourcecode language='php'>...</sourcecode> or <sourcecode language='sql'>...</sourcecode>, etc... GeSHi supports dozens of langauges.
|
||||
|
||||
[h2]More Information[/h2]
|
||||
|
||||
I have a more detailed explanation of this plugin at the Google Code site: [url]http://code.google.com/p/geshiforci/[/url]
|
||||
I have a more detailed explanation of this plugin at the Google Code site: [url]https://github.com/caseyamcl/geshiforci[/url]
|
Loading…
x
Reference in New Issue
Block a user