Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/11/2010, 17:05
Avatar de truman_truman
truman_truman
 
Fecha de Ingreso: febrero-2010
Ubicación: /home/user
Mensajes: 1.341
Antigüedad: 15 años
Puntos: 177
Respuesta: Sistema de noticias Leer mas.

Bueno ya que nadie contestaba tube que pensar como hacerlo y se me ocurrió una forma de hacerlo, por favor digan que les parece:



Código PHP:
<?php
//texto con etiquetas html
$texto='<p>descripcion </p><p>descripcion descripcion</p><p> descripcion <img src="img/1287042516_graduated.png" width="35" height="35" />descripcion </p>';
//mostramos el texto original
echo 'TEXTO ORIGINAL:'.$texto;
echo 
'<hr>';
//convertimos la cadena en un array
$texto=str_split($texto);
//mostramos el texto limpio
echo 'TEXTO LIMPIO SIN ETIQUETAS HTML:<br>';
foreach (
$texto as $caracteres){
    if(
$caracteres=='<'){
        
$control=1;
    }
    if(
$caracteres=='>'){
        
$control=2;
    }
    if(
$control==0){
        echo 
$caracteres;
    }
    if(
$control==2){
    
$control=0;
    }
}
?>
__________________
la la la