I'm looking for a open source PHP script to colorize the code inside
<code></code>
or
[code][/code] tags.
Thanks
I'm looking for a open source PHP script to colorize the code inside
<code></code>
or
[code][/code] tags.
Thanks
Assuming you want something other than the built-in syntax highlighter, GeSHi looks like it might fit your requirements:
GeSHi started as an idea to create a generic syntax highlighter for the phpBB forum system, but has been generalised to this project. GeSHi aims to be a simple but powerful highlighting class, with the following goals:
- Support for a wide range of popular languages
- Easy to add a new language for highlighting
- Highly customisable output formats
PHP has some built in functions for this purpose. Check if highlight_string or highlight_file will work for you
You could also try a clientside/javascript highlighter:
http://code.google.com/p/google-code-prettify/
- Supports all C-like, Bash-like, and XML-like languages.
(This is the one used on stackoverflow.com/ and code.google.com/)