note 53515 added to function.highlight-string
| From: | dleavitt at ucsc dot edu | Date: | Sat, 04 Jun 2005 09:37:15 +0000 |
| Subject: | note 53515 added to function.highlight-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89896@lists.php.net to get a copy of this message | ||
This function does not seem to like <script> tags in HTML strings: if there are any close tags
for scripts (whatever their language/type) the syntax highlighter will poop out. The workaround is
simple though:
<?php
$html_string = str_replace("script","piggusmaloy", $html_string);
$html_string = highlight_string($html_string, true);
$html_string = str_replace("piggusmaloy","script", $html_string);
echo $html_string;
?>
This works best if you don't have "piggusmaloy" anywhere in your string (a safe
assumption?)
----
Manual Page -- http://www.php.net/manual/en/function.highlight-string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53515
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53515&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53515&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53515&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53515&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53515&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53515&report=yes
Search -- http://master.php.net/manage/user-notes.php