View Single Post
Old Mar 20th, 2007, 6:41 AM   #13
Styx
Programmer
 
Join Date: Mar 2007
Posts: 39
Rep Power: 0 Styx is on a distinguished road
heh, all things considered, you could conceivably just reduce it to:

[php]<style type="text/css">
.num {
float: left;
color: #777777;
text-align: right;
margin-right: 8px;
padding-right: 8px;
border-right: 1px #999999 solid;}

body {
font-family: Courier New;
font-size: 10pt;}
</style>
<html><body>
<?php
$file = basename($_SERVER['PHP_SELF']);

$lines = file($file);

echo '<div class="num">';
for ($i = 1; $i <= count($lines); $i++)
{
echo "$i<br />";
}
echo '</div>';
highlight_file($file);
?>
</body></html>[/php]
Once you put the numbers off to the left and separate it like that, you don't need to split the file anymore. Just make sure the line numbers line up (with a common font and size) and that's it. (This ignores line wrapping of course.)
Styx is offline   Reply With Quote