Forum Moderators: coopster
<snip>
[edited by: dreamcatcher at 7:06 pm (utc) on Oct. 29, 2009]
[edit reason] No Urls Please. See TOS. [/edit]
Many (so called) WYSIWYG and Text Code Editors [webmasterworld.com] support line numbering... and stuff like syntax highlighting and folding - all of which make it easier to 'jump' to the relevant section if... I mean when validators find bugs in your html, css, php, javascript, etc
___________
* was: your link will be removed as it contravenes the ToS here at WebmasterWorld
A sample idea, let's say you have your code in a file.
<table>
<tr><td><label for="Email">Email"</label></td><input type="text" name="Email" id="Email"></td></tr>
<!-- etc -->
</table>
You could open the file, and read it line by line:
list = '';
$fhandle = @fopen($myfile, "r");
if (is_file($myfile) and $fhandle) {
while (!feof($fhandle)) {
$buffer = fgets($fhandle, 4096);
$buffer = htmlentities($buffer);
// so the code doesn't render
$list .= '<li>' . $buffer . '</li>';
}
fclose($fhandle);
if ($list != '') {
$list = '<ol>' . $list . '</ol>';
echo $list; // or return, in a function
}
else { echo "No sample code." }
}
else { echo "OOPS. Invalid file." }
How you'd insert spacing to emulate the tabs for the code formatting will be a task you'll have to figure out.