note 79547 deleted from function.highlight-file by nlopess
| From: | nlopess@php.net | Date: | Sun, 02 Dec 2007 19:55:37 +0000 |
| Subject: | note 79547 deleted from function.highlight-file by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-132754@lists.php.net to get a copy of this message | ||
Note Submitter: Cathy
----
Here is my printable version of line numbering (no floats). It also wraps lines correctly,
preserving the original numbering.
.num {
width: 22px;
color: #777;
text-align: right;
margin-right: 3px;
padding-right: 3px;
border-right: 1px solid #777;
}
<?php
function highlight_num($file) {
$lines = explode("<br />", highlight_file($file, true));
foreach ($lines as $line_num => $line)
$output .= "<br /><code class=\"num\">" . ($line_num + 1) .
"</code>" . $line;
echo $output;
}
?>