View Single Post
Old Mar 19th, 2007, 10:48 PM   #17
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 856
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Here is a shorter version of Arevos' code. It solves the issue of exploding on "<br />" brought up by DaWei.

PHP Syntax (Toggle Plain Text)
  1. <?php
  2. $filename = 'syntax_h.php';
  3. $num_lines = count(file($filename));
  4. ?>
  5.  
  6. <div class="lineNumbers">
  7. <code><?php print implode(range(1, $num_lines), "\n<br />") ?></code>
  8. </div>
  9. <div class="sourceCode">
  10. <?php highlight_file($filename); ?>
  11. </div>
titaniumdecoy is offline   Reply With Quote