I'm in the process of writing a PHP tutorial for my site and was wondering if there was an easy way to display short syntax-highlighted code-snippets on a webpage. I'm aware of the show_source() function which can be used on individual files, but this is cumbersome when you just want to show short code segments. If anyone has any ideas on how to accomplish this, please email me at php@vamsi.net
Thanks, Vamsi http://php.vamsi.net
Couldn't you just enclose the code snippet in a PRE tag, like this: <pre> $blah = htmlspecialchars($blah); $blah = ereg_replace( "(<😉(/{0,1})(b|big|i|p|small)(>😉", "<\2\3>", $blah); </pre>
That's pretty much what I'm doing right now, but that doesn't syntax-highlight the code like show_source() does right?
I tried to find the documentation on the show_source() function on www.php.net, but I couldn't find anything. Mayber there is a way to pass it a code snippet rather than a file... I am not sure. The <pre> tag definitely won't give you syntax-highlighted code.
Did the code library here do that at one point? I see that you can't even view the scripts from the server now. I thought you could do this before.
The server here crashed not too long ago, and searching just doesn't seem to work. I've found the docs on show_source() on the www.php.net site before, but now they don't seem to exist. I haven't the slightest clue on what is going on beyond that.
they exist, its just they keep disappearing