note 74018 modified in function.highlight-file by bobby
| From: | bobby@php.net | Date: | Wed, 21 Mar 2007 15:04:23 +0000 |
| Subject: | note 74018 modified in function.highlight-file by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124673@lists.php.net to get a copy of this message | ||
Here's a better take at highlighting a file with line numbers:
<?php
function highlight_num($file)
{
echo '<code class="num">', implode(range(1, count(file($file))),
'<br />'), '</code>';
highlight_file($file);
}
?>
along with the appropriate css
Thanks for the implode() part from Arevos at programmingforums.org
--was--
sorry, in my previous post, you can shorten the function to:
<?php
function highlight_num($file)
{
echo '<code class="num">', implode(range(1, count(file($file))),
'<br />'), '</code>';
highlight_file($file);
}
?>
along with the appropriate css
Thanks for the implode() part from Arevos at programmingforums.org
http://php.net/manual/en/function.highlight-file.php