Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/10/2009, 15:16
Avatar de neodani
neodani
 
Fecha de Ingreso: marzo-2007
Mensajes: 1.811
Antigüedad: 17 años, 1 mes
Puntos: 20
Respuesta: Colorear sintaxis php con highlight_file()

Cita:
Iniciado por abimaelrc Ver Mensaje
Te sugiero que mires este ejemplo de GatorV, muy bueno http://web2development.blogspot.com/...n-blogger.html
Gracias por el enlace ;)

Lo conseguí utilizando lo siguiente:

Código php:
Ver original
  1. <?php
  2. function highlight_num($file)
  3. {
  4.     $lines = implode(range(1, count(file($file))), '<br />');
  5.     $content = highlight_file($file, true);
  6.     echo "<table><tr><td class=\"num\">\n$lines\n</td><td>\n$content\n</td></tr></table>";
  7. }
  8. ?>
  9.  
  10. <div class="TextView">
  11. <pre>
  12. <?php
  13. highlight_num('prueba.php');
  14. ?>
  15. </pre>
  16. </div>