note 54215 deleted from function.highlight-string by betz
| From: | betz@php.net | Date: | Mon, 27 Jun 2005 20:02:15 +0000 |
| Subject: | note 54215 deleted from function.highlight-string by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-91041@lists.php.net to get a copy of this message | ||
Note Submitter: simon at skoom dot de
Reason: bad code
----
- line numbers are unmarkable
- predefined functions are linked to php.net
- Coloring tags are not cutted at the end of each row (e.g. /* \n */ )
<?function showCode($code) {
$html = highlight_string($code, true);
$html = str_replace("\n", "", $html);
$rows = explode("<br />", $html);
$row_num = array();
$ii = array();
$i = 1;
foreach($rows as $row) {
if($i < 10) {
$i = "0".$i;
}
$temprow = "$row\n";
$temprow = ereg_replace(
"([a-z,_]+) *</font><font color=\"#007700\">\(",
"<a href=\"http://www.php.net/\\1\"
target=\"blank\">\\1</a></font><font
color=\"#007700\">(",
$temprow);
$row_num[]=ereg_replace(
"function </font><font color=\"#0000BB\"><a href=\"http://www.php.net/([a-z,_]+)\"
target=\"blank\">([a-z]+)</a>"
,"function </font><font color=\"#0000BB\">\\1",
$temprow);
$ii[]=$i;
$i++;
}
$iii=($i-1)*11;
return "<div style=\"position:absolute; left:0px; top:0px; width:100%;
z-index:2;\">"
."<table style=\"border:0px #000000 solid\" cellspacing=0 cellpadding=0
height=1><tr>"
."<td width=\"40\" valign=\"bottom\"
align=\"left\"></td><td width=\"*\" valign=\"top\"
align=\"left\">"
."<pre>".implode($row_num)."\n
</pre></td></tr></table></div>"
.'<div style="position:absolute; left:0px;top:0px; width:20px;z-index:1;
border-right:1px solid black;">'
.'<table style="border:0px #000000 solid" cellspacing=0 cellpadding=0
height=1><tr>'
.'<td width="*" valign="top"
align="left"><pre>'.implode("\n",$ii).'</pre>
</td></tr></table></div>';
} ?>