Page 1 of 1

PHP syntax highlighting

Posted: Thu Dec 18, 2003 12:03 pm
by nuke-x
I am writing a source code section for my website and want the php code to be highlited. To do this i am using the function [php_man]highlight_string[/php_man] and its not going very well.

It is all brought from one variable, which inside that variable is a selection of text and then php code.

I want it sort of like the [ php] function on this forum.

If any one knows where how to do then please tell me. Thanks :D

Posted: Thu Dec 18, 2003 2:41 pm
by DuFF
I've never tried anything like this but you could take a look at the code for the [ php] mod.

http://www.phpbb.com/phpBB/viewtopic.php?t=119512

Posted: Thu Dec 18, 2003 2:48 pm
by JAM
...or use the code-searchengine on http://www.evilwalrus.com for it. There are a couple with various tweaks there to learn from.

Posted: Fri Dec 19, 2003 1:53 pm
by Derfel Cadarn
Isn't it easier to just save the files you want to show with an .phps-extension?
I admit you'll need to store the same files twice (as .php and as .phps) and that it's a childish solution, but it's the safest I can think of!