Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/05/2008, 02:07
Proguri
 
Fecha de Ingreso: abril-2008
Ubicación: Montevideo - Uruguay
Mensajes: 156
Antigüedad: 16 años, 10 meses
Puntos: 5
Re: Creación de XML con PHP (Problema con bucle)

Hi !

Prueba asi :
Código PHP:
<?php


$xml 
'<?xml version="1.0" encoding="utf-8"?>'."\n";
$xml.= '<playlist version="1" xmlns="http://xspf.org/ns/0/">'."\n";
$xml.= '<trackList>';

$path="../images/stories/audios/"
$directorio=dir($path);

$name_file="archivo.xml";
$file=fopen($name_file,"w+");

while (
$archivo $directorio->read())
{
    if (
$archivo!="." && $archivo!="..")
    {
        
$xml.='
    <track>
    <annotation>'
.$archivo.'</annotation>
    <location>*****/***********/'
.$archivo.'</location>
    </track>'
;
        
    }
}
$xml.= "\n".'</trackList>'."\n";
$xml.= '</playlist>';

fwrite ($file$xml);
fclose($file); 
$directorio->close();
?>
Espero te sea de ayuda :)

-ByE-

Última edición por Proguri; 03/05/2008 a las 02:25 Razón: Error en el codigo brindado. Solucionado