Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/05/2007, 14:39
Avatar de el cirujano
el cirujano
 
Fecha de Ingreso: mayo-2003
Ubicación: Frente al PC
Mensajes: 609
Antigüedad: 21 años
Puntos: 3
Re: cómo crear un XML con php?

me imagino que esto es lo que se debe crear repetitivamente:
Código PHP:
<image>
   <
filename>'. $_POST["Nom"] .'</filename>
   <
caption>'. $_POST["Des"] .'caption>
   <
width>'. $_POST["W"] .'</width>
   <
height>'. $_POST["H"] .'</height>
</
image
bueno apliquemos aqui algo que se pueda decir como logica....

Código PHP:
<?
       $trans_tbl 
get_html_translation_table(HTML_ENTITIES);
       foreach(
$trans_tbl as $k => $v)
       {
           
$ttr[$v] = utf8_encode($k);
       }
   
       
$text strtr($text$ttr);
if(isset(
$_POST['dato'])){
$datos '<?xml version="1.0" encoding="UTF-8"?>
<gallery title="Example Title" frameColor="0xFFFFFF" frameWidth="10" imagePadding="20" displayTime="6">'
;

$cantidad "X"//numero de imagenes

for ($i$i<$cantidad$i++)
{
$datos .= '<image>
   <filename>'
$_POST["Nom"][$i] .'</filename>
   <caption>'
$_POST["Des"][$i] .'caption>
   <width>'
$_POST["W"][$i] .'</width>
   <height>'
$_POST["H"][$i] .'</height>
</image>'
;
}

$datos .= '</gallery>';
$archy$_POST["dato"];
$file fopen($archy,"w-");
fwrite($file,utf8_encode($datos));fclose($file);
header("Location: oksend.htm"); 
}
else
{
echo 
"output=no se han recibido los datos";
}
?>
claro esta, no lo he probado, no se cuales son los campos y lo acabo de hacer, pero por ahi va la solucion...

Saludos
__________________
CSS2 + AJAX + PHP + MySQL, una mezcla sin competencia!!!!!!