Foros del Web » Programando para Internet » PHP »

Necesito obtener valores delimitados con <!--etiqueta-->

Estas en el tema de Necesito obtener valores delimitados con <!--etiqueta--> en el foro de PHP en Foros del Web. Hola, necesito obtener los resultados de un codigo html dentro de las etiquetas <!--inicioimpresion--> y <!--finimpresion--> tengo este codigo: $startingpoint = "<!--inicioimpresion-->"; $endingpoint = "<!--finimpresion-->"; ...
  #1 (permalink)  
Antiguo 15/03/2006, 10:51
Avatar de CHILENOCES  
Fecha de Ingreso: octubre-2001
Ubicación: Mmm paseando por la vida
Mensajes: 491
Antigüedad: 22 años, 6 meses
Puntos: 0
Necesito obtener valores delimitados con <!--etiqueta-->

Hola,
necesito obtener los resultados de un codigo html dentro de las etiquetas
<!--inicioimpresion--> y <!--finimpresion-->

tengo este codigo:
$startingpoint = "<!--inicioimpresion-->";
$endingpoint = "<!--finimpresion-->";

$start= strpos($value, "$startingpoint");
$finish= strpos($value, "$endingpoint");
$length= $finish-$start;
$value=substr($value, $start, $length);

y luego hago un echo a $value pero no me resulta no me muestra nada.

Espero su ayuda,
muchas gracias y saludos.
__________________
ChilenoCesar Looking for something new...
  #2 (permalink)  
Antiguo 15/03/2006, 10:59
Avatar de claudiovega  
Fecha de Ingreso: octubre-2003
Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 20 años, 6 meses
Puntos: 11
Probé tu codigo y funciona, esta fue mi prueba:

Código PHP:
<?php
   $startingpoint 
"<!--inicioimpresion-->";
   
$endingpoint "<!--finimpresion-->";
   
$value="<!--inicioimpresion-->Hola Mundo<!--finimpresion-->";
   
$startstrpos($value"$startingpoint");
   
$finishstrpos($value"$endingpoint");
   
$length$finish-$start;
   
$value=substr($value$start$length);
   echo 
$value;
?>
  #3 (permalink)  
Antiguo 15/03/2006, 10:59
Avatar de Seppo  
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
En http://www.forosdelweb.com/showthrea...ht=preg+inicio habían hecho algo parecido, quizás te ayude
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:28.