Click to See Complete Forum and Search --> : Numbered Code
The Little Guy
05-16-2006, 08:41 PM
Would it be possible to have coded lines when you wrap you code in one of these vB codes:
HTML
CODE
PHP
Example:
<?php
echo "Hello";
?>
so... when the code is outputted it would look something like this:
1 <?php
2 echo "Hello";
3 ?>
Then, when someone highlights the code, to copy and past or something, it selects everything but the numbers
JPnyc
05-16-2006, 08:48 PM
Sorry but I would have to say no.
David Harrison
05-16-2006, 10:31 PM
If you use a list to display code in, then when you select it in a decent browser, you get a # at the beginning of each line to denote a new <li>. Not sure if it's a # for an ordered list, could be a number. Either way, the code would instantly break.
The Little Guy
05-17-2006, 12:37 AM
It wouldn't instantly break, if you used 2 divs, one for the numbers, and one for the code, you would only be able to select from one div or you could select both.
David Harrison
05-17-2006, 02:27 AM
I see, so instead of a list, you just have a column of numbers and a <pre> element. That would work, but it'd be completely messed up without page styles. Maybe an effect that could be done with JavaScript.
pcthug
05-17-2006, 02:39 AM
Q. Why the urgent need for line numbers? I mean any referencing can be done with comments inside the code, and if it's absolutly necessary to see the exact line number - you can always just paste the code in a decent editor.
bathurst_guy
05-21-2006, 03:13 AM
or use the good old method of counting :P