note 33956 deleted from function.highlight-string by aidan

From: Date: Sun, 26 Sep 2004 13:47:46 +0000
Subject: note 33956 deleted from function.highlight-string by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77367@lists.php.net to get a copy of this message
Note Submitter: marc at NOSPAM dot giombetti dot com ---- There are already some functions for numbering and highliting a string containging PHP sourcecode on this site, but they were buggy or wasted recouces. I hope this snippet fits your needs. function my_highlight($text){ $text2 = stripslashes($text); $split = split("\n", $text2); $mv = count($split); /*for design reasons */ if($mv < 100){ $width = "14"; }elseif($mv < 1000){ $width = "22"; }elseif($mv < 10000){ $width = "30"; }else{ $width = "14"; } /*--------------------*/ echo "<table bgcolor=\"#90ab83\" cellspacing=\"0\" width=\"100%\">"; $text2 = highlight_string($text2, true); for($i = 0; $i < $mv; $i++){ $t = $i + 1; echo "<tr><td bgcolor=#7C9B6D width=$width><div align=right><font face=\"verdana\" size=\"1\">".$t."</font></div></td>"; if($t < 2) { echo "<td style=\"padding-left: 5px\" rowspan=\"10000\" valign=\"top\">".$text2."</td>"; } echo "</tr>"; } echo"</table>"; } Yours Sincerely Marc Giombetti - www.giombetti.com

« previous php.notes (#77367) next »