Subject: [Nel] cpp to html in php :)

From: "Vianney Lecroart" <[email-masked]>
Date: Fri, 1 Mar 2002 16:49:21 +0100

Hi,

Do you know where I can find a little php function that take a string (cpp
code) in param and that echoed the string with html tag to format the param
(with color hightlight etc...) like they do in flipcode site for example:
http://www.flipcode.com/cgi-bin/msg.cgi?showThread=Tip-UnusedParameters&foru
m=totd&id=-1

Vianney Lecroart
---
lead network programmer / nevrax.com
icq#: 6870415
homepage: http://ace.planet-d.net
www.geekcode.com: GCS/E d- s+++: a-- C+++$ UL++ P- L+++>+$ E+>- W++ N+ o? K-
w++$ O- M- V- PS- PE? Y PGP t 5? X+ R- tv++ b- DI D+ G e++ h+ r-- y?

---

From: Yan Babilliot <[email-masked]>
Date: 01 Mar 2002 17:22:49 +0100

> http://www.flipcode.com/cgi-bin/msg.cgi?showThread=Tip-UnusedParameters&foru

Check http://www.beautifier.org/ , a flexible syntax hilighting system
written in PHP.
You can also use show_source(), highlight_string(), highlight_file(),
but they only support PHP syntax.

Yan.

---

From: Vincent Caron <[email-masked]>
Date: 01 Mar 2002 17:47:37 +0100

I use a little wrapper around 'enscript', which is a good multi-language
and multi-media beautifier :

function snippet($file, $lang)
{
  $output = `enscript -q -E$lang -Whtml --color -o - $file`;
  $start = strpos ($output, '<PRE>');
  $end = strpos ($output, '</PRE>') + strlen('</PRE>');
  return substr ($output, $start, $end-$start);
}

You just invoke 'echo snippet("/path/to/test.cpp", "cpp")'. It can be
modified to support 'inline code' (ie. passed from a string in the PHP
code) though ...