Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/03/2009, 14:09
Avatar de yobain
yobain
 
Fecha de Ingreso: febrero-2009
Ubicación: Mérida
Mensajes: 25
Antigüedad: 16 años, 1 mes
Puntos: 1
Respuesta: Guardar codigos en base de datos

puedes usar el FCKEDITOR

para poder editar el contenido php es facil de implementar o utilizar un lector de codigo


o este funcion te servirar para ahcerlo como lo hace la pagina oficial de php

Código PHP:
<?
function ColoreaCodigo($texto) {
$texto str_replace("
"
""$texto);
$texto str_replace("
"
""$texto);
$texto str_replace(">"">"$texto);
$texto str_replace("<""<"$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('"''"'$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,'<?');
$cerrarpost strrpos($buffer'?');
$buffer=substr($buffer0$abrirpost).substr($buffer$abrirpost+5$cerrarpost-($abrirpost+5)).substr($buffer$cerrarpost+5);
}
$buffer=str_replace("","",$buffer);
$buffer=str_replace("","",$buffer);
return 
$buffer;
}
?>