0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<h3>Generate Line Number Anchor Links</h3>
<?php $base="/home/lance/inc/public_html"; if ($HTTP_GET_VARS['file']!="") { $the_file=$HTTP_GET_VARS['file']; $lines = file($the_file); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; } highlight_file($base.$PHP_SELF); } if ($HTTP_GET_VARS['file']=="") { echo "<hr>\n"; $lines=file($base.$PHP_SELF); echo "<table border=1><tr><td>\n"; foreach ($lines as $line_num => $line) { echo "<a name=".$line_num."><a href=\"#".$line_num."\">".$line_num."</a><br>\n"; } echo "</td><td>\n"; foreach ($lines as $line_num => $line) { echo htmlspecialchars($line)."<br />\n"; } echo "</td></tr></table>"; } ?> |
No comments:
Post a Comment