views:

41

answers:

3

You guys know in Pastebin how according to the selected language, the code is colored?

Is there a control I can use on my site? I'm using PHP and Zend Framework.

Edit: I was thinking something along the lines of:

CodeControl mycontrol = new CodeControl(sourcecode.txt, 'c#');

or

CodeControl mycontrol = new CodeControl(sourcecode.txt, 'javascript');

I'm sure someone already has done this, no point in reinventing the wheel. :)

A: 

http://css-tricks.com/highlight-code-with-php/

Works pretty well

azz0r
A: 

There's a builtin function - highlight_string() but it only really deals with PHP source. You might want to try GeSHi which supports lots of langs.

C.

symcbean
+2  A: 

You can use PHP's highlight_string function for that. You can also use Prettify the code colorizer that StackOverflow uses.

Sarfraz