highlighting HTML code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ForBeginners
Forum Newbie
Posts: 1
Joined: Sat Dec 07, 2002 4:21 am

highlighting HTML code

Post 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
dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post by dusty »

you could make a script to highlight html, but there is no function to do it for you.
User avatar
Traduim
Forum Newbie
Posts: 11
Joined: Tue Dec 10, 2002 4:21 am
Location: Catalunya

Post 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);
?>
Post Reply