> -----Original Message----- > From: T.Lensselink [mailto:dev@xxxxxxxx] > Sent: Thursday, November 15, 2007 12:05 AM > > On Wed, 14 Nov 2007 23:45:40 -0800, "Daevid Vincent" <daevid@xxxxxxxxxx> wrote: > > I want to put a code snippet section on my site and want to > > colorize them like the user comments on any PHP site page. > > > > http://www.php.net/manual/en/language.operators.arithmetic.php > > > > What's the easiest way to do that? > > > > I've used Geshi, but that seems a lot of overhead just to > > colorize a wee bit-o-PHP code. > Take a look at highlight_string or highlight_file. > > http://nl3.php.net/manual/en/function.highlight-string.php > http://nl3.php.net/manual/en/function.highlight-file.php Worked pretty good. It seems to have trouble with the \ and \\ chars for some reason, but close enough for jazz as they say... (notice the array has \\ when it should only be a single one, however if I get that to work, then the color coding after it is messed up and the \n don't show up. Grr.) Czech out http://daevid.com "Free Code > Code Snippets" I think the little curled corners are slick too! PHP.net, you're free to borrow my idea/CSS for your website if you like :D Now if only the colorize/highlight functions worked on other types of source code (ruby, bash, procmail, etc)... Maybe I'll just have to use Geshi afterall... D.Vin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php