note 42363 added to function.highlight-file
| From: | dave_arter at hotmail dot com | Date: | Thu, 13 May 2004 13:21:23 +0000 |
| Subject: | note 42363 added to function.highlight-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69561@lists.php.net to get a copy of this message | ||
You may have noticed that this function doesn't return valid XHTML, due to its use of the
<font> tags. Here's my solution to this problem:
<?php
function highlight_file_xhtml($file, $return=FALSE){
$syntax = show_source($file, TRUE);
$syntax = str_replace("<font color=\"", "<span style=\"color:
", $syntax);
$syntax = str_replace("</font>", "</span>", $syntax);
if ($return){
return $syntax;
} else {
print $syntax;
}
}
?>
Syntax of this function is exactly the same as PHP's highlight_file().
----
Manual Page -- http://www.php.net/manual/en/function.highlight-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42363
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42363&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42363&report=yes
Search -- http://master.php.net/manage/user-notes.php