Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/12/2005, 08:29
Avatar de DanielLucia
DanielLucia
 
Fecha de Ingreso: noviembre-2005
Ubicación: Cádiz (España)
Mensajes: 170
Antigüedad: 20 años, 11 meses
Puntos: 0
colorear codigo php

bueno... este es el script q he conseguido en otra web.. pero la verda q no me responden alli y no se q pasa... este es el codigo:
(lo unico q kiero q se vea como estoooo!!)
Código PHP:
<?php 
if (isset($_GET['Aceptar']))
{
function 
ColoreaCodigo($texto) {
$texto = str_replace("
"
, "", $texto);
$texto = str_replace("
"
, "", $texto);
$texto = str_replace("&gt;", ">", $texto);
$texto = str_replace("&lt;", "<", $texto);
$texto = str_replace("&", "&", $texto);
$texto = str_replace('$', '$', $texto);
$texto = str_replace('n', 'n', $texto);
$texto = str_replace('r', 'r', $texto);
$texto = str_replace('t', 't', $texto);
$texto = str_replace('&quot;', '"', $texto);
$texto = stripslashes($texto);
ob_start();
$nivelviejo=error_reporting(0);
highlight_string($texto);
error_reporting($nivelviejo);
$buffer = ob_get_contents();
ob_end_clean();
if (
$variable) {
$abrirpost = strpos($buffer,'&lt;?');
$cerrarpost = strrpos($buffer, '?');
$buffer=substr($buffer, 0, $abrirpost).substr($buffer, $abrirpost+5, $cerrarpost-($abrirpost+5)).substr($buffer, $cerrarpost+5);
}
$buffer=str_replace(" ","",$buffer);
$buffer=str_replace(" ","",$buffer);
return 
$buffer;
}
$codigo=$_GET['textarea'];
$codigo=ColoreaCodigo($codigo); 
echo 
"$codigo";
}
else
{
?>
<form name="form1" method="get" action="">
  <p>
    <textarea name="textarea" cols="70" rows="10"></textarea>
</p>
  <p>
    <input name="Aceptar" type="submit" id="Aceptar" value="Enviar">
</p>
</form>
<?php
} 
?>
la funcion es lo q e copiado de la otra web, pero no me colorea el codigo... no se.. a la variable le paso el valor bien no? ya no se q acerr!! aver si alguien me podria ayudar, xq x mas q le doy vueltas... no lo veo...

gracias de antemano!! y saludos desde cadiiiiiiiii!!