Foros del Web » Programando para Internet » PHP »

Problema PHP y XML

Estas en el tema de Problema PHP y XML en el foro de PHP en Foros del Web. Pues estoy haciendo un código que extrae en bbcode de un foro SMF las imágenes, para crear un XML que lo utilizo para un rotador ...
  #1 (permalink)  
Antiguo 22/07/2011, 07:06
 
Fecha de Ingreso: mayo-2008
Mensajes: 315
Antigüedad: 15 años, 11 meses
Puntos: 7
Problema PHP y XML

Pues estoy haciendo un código que extrae en bbcode de un foro SMF las imágenes, para crear un XML que lo utilizo para un rotador de imágenes.

El problema es que me marca un error el XML que no consigo descubrir que es.

ERROR:
Código:
This page contains the following errors:

error on line 34 at column 98: EntityRef: expecting ';'
Below is a rendering of the page up to the first error.
CODIGO PHP:
Código PHP:
<?php
header
("Content-Type: text/xml");
$slides "";
function 
effect(){
srand((double)microtime()*1234567);
$effects = array(
'num="3" slicing="vertical" direction="down" cube_color="0xFFFFFF"',
'num="4" direction="right" shader="flat" cube_color="0xFFFFFF"',
'num="6" slicing="vertical" direction="up" shader="flat" delay="0.05" z_multiplier="4" cube_color="0xFFFFFF"',
'num="4" direction="right" shader="phong" cube_color="0xFFFFFF"');
return 
$effects[mt_rand(0,count($effects)-1)];
}
require(
"Settings.php");
$conexion mysql_connect($db_server$db_user$db_passwd);
mysql_select_db($db_name $conexion);

$post2 mysql_query("SELECT * FROM smf_topics WHERE id_board='1'  ORDER BY id_topic DESC LIMIT 5");
    while (
$totolia2 mysql_fetch_array($post2)) {
$id $totolia2['id_topic'];
$post mysql_query("SELECT * FROM smf_messages WHERE id_topic='" $id "' ORDER BY id_msg DESC");
    while (
$totolia mysql_fetch_array($post)) {

$body22 $totolia['body'];
$title $totolia['subject'];
$contenido1 $totolia['body'];
$contenido substr($contenido1030);


$parser "|\[img\](.*?)\[/img\]|is";
$elpost "";
if (
preg_match($parser$body22$video1)){ 
    
$elpost $video1[1];


if (
$elpost == $body22 || $elpost == "IMAGEN PARA LA PORTADA" || $elpost == ""){
$slides.= '<slide></slide>';
} else {
// Cogiendo valor fuente
$slides.= '<slide><url>thumb.php?ruta='.$elpost.'&ancho=500</url><link target="_self">index.php?topic='.$id.'</link><description><link target="_self">index.php?topic='.$id.'</link><heading>'.$title.'</heading><paragraph>'.$contenido.' [...]</paragraph></description></slide><transition '.effect().' />'."\n";
}
}
}
}


echo(
'<?xml version="1.0" encoding="utf-8" ?>
<cu3er>
     <settings>
    
          <auto_play>
          <defaults symbol="circular" time="3" />
          <tweenOver tint="0xFFFFFF" scaleX="1.1" scaleY="1.1"/>
          <tweenOut tint="0xFFFFFF"/>
          </auto_play>          
    
         <prev_button>
               <defaults round_corners="5,5,5,5"/>
               <tweenOver tint="0xFFFFFF" scaleX="1.1" scaleY="1.1"/>
               <tweenOut tint="0x000000" />
          </prev_button>
          
         <prev_symbol>
               <tweenOver tint="0x000000" />               
          </prev_symbol>
          
         <next_button>
               <defaults round_corners="5,5,5,5"/>               
               <tweenOver tint="0xFFFFFF"  scaleX="1.1" scaleY="1.1"/>
               <tweenOut tint="0x000000" />
          </next_button>
          
         <next_symbol>
               <tweenOver tint="0x000000" />
          </next_symbol>     
               
     </settings>    

     <slides>
'
.$slides.'                    
     </slides>
</cu3er>'
);
    
?>

Alguna idea chicos? Gracias ;)
  #2 (permalink)  
Antiguo 22/07/2011, 07:13
 
Fecha de Ingreso: diciembre-2008
Mensajes: 805
Antigüedad: 15 años, 4 meses
Puntos: 20
Respuesta: Problema PHP y XML

me podrias decir que hay en la linea 34???
  #3 (permalink)  
Antiguo 22/07/2011, 07:14
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 10 meses
Puntos: 1517
Respuesta: Problema PHP y XML

Trata convirtiendo las entidades en caracter normal. Verifica la linea que te in indica y dinos que hay en esa linea.
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #4 (permalink)  
Antiguo 22/07/2011, 07:18
 
Fecha de Ingreso: mayo-2008
Mensajes: 315
Antigüedad: 15 años, 11 meses
Puntos: 7
Respuesta: Problema PHP y XML

Mira es que no lo entiendo me marca error. Pero miro el codigo fuente y en cambio parece correcto. Un ejemplo de lo que me extrae:
Código:
<cu3er> 
     <settings> 
    
          <auto_play> 
          <defaults symbol="circular" time="3" /> 
          <tweenOver tint="0xFFFFFF" scaleX="1.1" scaleY="1.1"/> 
          <tweenOut tint="0xFFFFFF"/> 
          </auto_play>          
    
         <prev_button> 
               <defaults round_corners="5,5,5,5"/> 
               <tweenOver tint="0xFFFFFF" scaleX="1.1" scaleY="1.1"/> 
               <tweenOut tint="0x000000" /> 
          </prev_button> 
          
         <prev_symbol> 
               <tweenOver tint="0x000000" />               
          </prev_symbol> 
          
         <next_button> 
               <defaults round_corners="5,5,5,5"/>               
               <tweenOver tint="0xFFFFFF"  scaleX="1.1" scaleY="1.1"/> 
               <tweenOut tint="0x000000" /> 
          </next_button> 
          
         <next_symbol> 
               <tweenOver tint="0x000000" /> 
          </next_symbol>     
               
     </settings>    
 
     <slides> 
 LINEA 34 !! <slide><url>thumb.php?ruta=http://wanmagazine.com/web/wp-content/uploads/callofduty41-1.jpg&ancho=500</url><link target="_self">index.php?topic=1</link><description><link target="_self">index.php?topic=1</link><heading>Welcome to SMF!</heading><paragraph>[img]http://wanmagazine.com/we [...]</paragraph></description></slide><transition num="4" direction="right" shader="flat" cube_color="0xFFFFFF" /> 
                    
     </slides> 
</cu3er>

Vale era el &, lo he cambiado por &amp; y creo que la web gratuita donde hago pruebas, nose porque me inserta un script y por eso debe fallar.

Última edición por totolia; 22/07/2011 a las 07:27

Etiquetas: mysql, xml
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 07:15.