note 19326 modified in function.highlight-string by philip
| From: | philip@php.net | Date: | Wed, 15 May 2002 16:05:54 +0000 |
| Subject: | note 19326 modified in function.highlight-string by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30678@lists.php.net to get a copy of this message | ||
When your highlighting code using highlight_string() it tends to add a lot of
(non-breaking spaces) to the code. This can tend to mess up tables that don't have a set width.
A workaround for now is to remove all of those spaces.
<?
function showsource ($code) {
ob_start();
highlight_string($code);
$colorsource = ob_get_contents();
ob_end_clean();
$colorsource = str_replace (" ", " ", $colorsource);
return $colorsource;
}
$plain_code = "<? phpinfo(); ?>";
echo showsource($plain_code);
?>
I don't think this will totally solve the problem, but it does help.
--was--
When your highlighting code using highlight_string() it tends to add a lot of
(non-breaking spaces) to the code. This can tend to mess up tables that don't have a set width.
A workaround for now is to remove all of those spaces.
<?
function showsource ($code) {
ob_start();
highlight_string($code);
$colorsource = ob_get_contents();
ob_end_clean();
$colorsource = str_replace (" ", " ", $colorsource);
return $colorsource;
}
$plain_code = "<? php_info(); ?>";
echo showsource($plain_code);
?>
I don't think this will totally solve the problem, but it does help.
http://www.php.net/manual/en/function.highlight-string.php