Page 1 of 1

highlighting HTML code

Posted: Sat Dec 07, 2002 4:21 am
by ForBeginners
Hi,

Is is possible to highlight html code, the same way as highlighting php code.
Can someone help me with this?

I have already read the php.net/highlight_string but it is not there. So any other solutions please.

Thanks

Youri

Posted: Sun Dec 08, 2002 5:38 pm
by dusty
you could make a script to highlight html, but there is no function to do it for you.

Posted: Tue Dec 10, 2002 4:30 am
by Traduim
You just need to add <? at the beginning of the HTML code to highlight and ?> at the end.

Example:

Code: Select all

<?php
$thecode = show_source("http://www.myplainhtmlwebsite.com");

$highlighted = highlight_string("<?".$thecode."?>");

echo substr($highlighted, 2, -2);
?>