Ver Mensaje Individual
  #4 (permalink)  
Antiguo 12/02/2002, 08:56
Avatar de Ferdy
Ferdy
Colaborador
 
Fecha de Ingreso: junio-2001
Ubicación: España
Mensajes: 1.430
Antigüedad: 22 años, 11 meses
Puntos: 0
Re: funcion de PHP que colorea la sintasix

Yo acostumbro a usar una función como esta:<pre>&lt;?php
/**
* string colorea ( string datos ) - Devuelve la cadena con la sintaxis coloreada
**/
function colorea ( $datos )
{
// Abrimos el buffer de salida
ob_start();
// Si el dato es un fichero mostramos la sintaxis del contenido
if (file_exists($datos))
{
show_source($datos);
}
// En otro caso asumimos que es una cadena de código
else
{
highlight_string($datos);
}
// recogemos el contenido del buffer
$cnt = ob_get_contents();
// cerramos el buffer
ob_end_clean();
// devolvemos el contenido del buffer
return $cnt;
}
?&gt; </pre>

Salu2.Feliz Codding


- Fernando Pereda ( Ferdy )
<center><a href="http://www.ferdyx.org/firmas.php"><img src="http://www.ferdyx.org/reg_tira.jpg" border="0"></a></center>