note 44463 deleted from function.highlight-file by aidan

From: Date: Sun, 26 Sep 2004 13:55:35 +0000
Subject: note 44463 deleted from function.highlight-file by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77369@lists.php.net to get a copy of this message
Note Submitter: rehfeld.us ---- heres mine, it comes out looking pretty good. im sure someone could improve it if they needed more. converts to xhtml and has highlighted numbered lines on the left, the format is pretty solid. youll need to add the css to your <head> ######################## <style type="text/css"> #phpsource div { height: 20px; } #phpsource div b { width:35px; margin-right:10px; text-align:center; background:#F3F9BE; color:#6a7a7a; border-left:solid 1px #CCC; border-right:solid 1px #CCC;} </style> <div id="phpsource"> <code> <?php function xhtml_highlight($file, $return=FALSE) { $html = str_replace('</font>', '</span>', str_replace('<font color="', '<span style="color:', highlight_file($file, TRUE))); $lines = explode("\r", $html); array_unshift($lines, '00'); $i=1; while (false !== ($line = next($lines))) $string .= str_replace('<br />', '<div><b>'.$i++.'</b>', $line."</div>\r\n"); if ($return) return $string; echo $string; } /* just use it like normal, optional return or default print. */ $file = 'highlightme.php'; xhtml_highlight($file); ?> </code> </div>

« previous php.notes (#77369) next »