Foros del Web » Programando para Internet » PHP »

...XML....actualizable

Estas en el tema de ...XML....actualizable en el foro de PHP en Foros del Web. hola compañeros..........saben que estaba en mi humilde morada creando un xml cuando paaffffff, no me resulto el codigo....jajajaja....con el que queria lograr el siguiente fin. ...
  #1 (permalink)  
Antiguo 04/12/2008, 16:31
Avatar de pablosky13  
Fecha de Ingreso: septiembre-2008
Mensajes: 42
Antigüedad: 15 años, 7 meses
Puntos: 0
...XML....actualizable

hola compañeros..........saben que estaba en mi humilde morada creando un xml cuando paaffffff, no me resulto el codigo....jajajaja....con el que queria lograr el siguiente fin.
Crear un archivo.xml....y luego actualizarlo con el mismo formulario php.....para esto.....tenia un codigo.....el cual fui modificando bastante hasta perder el inicial, el cual me creaba el xml.......pero de todos modos logre crear mi xml con este codigo.
Código PHP:
<?
$arreglo_nombres
=array(

"TITULO"=>$TITULO $_POST["TITULO"],
"LINK"=>$LINK $_POST["LINK"],
"RESUMEN"=>$RESUMEN $_POST["RESUMEN"],
"NOTICIACOMPLETA"=>$NOTICIACOMPLETA $_POST["NOTICIACOMPLETA"],

); 

}
$buffer='<noticia>'
           
  while (list (
$etiqueta$valor) = each ($arreglo_nombres)): 
    
$buffer.="<$etiqueta>$valor<$etiqueta>"
  endwhile; 
  
$buffer.="</noticia>"
 
       
$archivo "archivo.xml";
       
$gestor fopen($archivo"a+");
       
fwrite($gestor"<?xml version='1.0' encoding='iso-8859-1'?><informacion>");
       
fwrite($gestor"$buffer");
       
fwrite($gestor"</informacion>");
    
<
a href='archivo.xml'>XML</a>

?>
Pero como mi idea es actualizarlo, encontre este codigo, pero no me resulta.
Código PHP:
<?
$arreglo_nombres
=array(

"TITULO"=>$TITULO $_POST["TITULO"],
"LINK"=>$LINK $_POST["LINK"],
"RESUMEN"=>$RESUMEN $_POST["RESUMEN"],
"NOTICIACOMPLETA"=>$NOTICIACOMPLETA $_POST["NOTICIACOMPLETA"],

); 

}

$buffer='<noticia>'
           
  while (list (
$etiqueta$valor) = each ($arreglo_nombres)): 
    
$buffer.="<$etiqueta>$valor<$etiqueta>"
  endwhile; 
  
$buffer.="</noticia>"
  
$buffer.="</file_xml>"
  
$file=fopen("archivo.xml","w+"); 
  
fwrite ($file,$buffer); 
  
fclose($file);
    
   if(
file_exists("archivo.xml")){
       
$archivo "archivo.xml";
       
$gestor fopen($archivo"a+");
       
fwrite($gestor"$buffer");
       
fseek($gestor0);
   } else {
       
$archivo "archivo.xml";
       
$gestor fopen($archivo"a+");
       
fwrite($gestor"<?xml version='1.0' encoding='iso-8859-1'?><informacion>");
       
fwrite($gestor"$buffer");
       
fwrite($gestor"</informacion>");
    
            }

<
a href='archivo.xml'>XML</a>

?>
Nesesito ayuda por favor.....
esto es lo que nesesito lograr....

Código HTML:
<informacion>
  <noticia>
     <TITULO></TITULO>
     <LINK></LINK>
     <RESUMEN></RESUMEN>
     <NOTICIACOMPLETA></NOTICIACOMPLETA>
  </noticia>
  
  <noticia>
     <TITULO></TITULO>
     <LINK></LINK>
     <RESUMEN></RESUMEN>
     <NOTICIACOMPLETA></NOTICIACOMPLETA>
  </noticia>
  
    <noticia>
     <TITULO></TITULO>
     <LINK></LINK>
     <RESUMEN></RESUMEN>
     <NOTICIACOMPLETA></NOTICIACOMPLETA>
  </noticia>
</informacion> 
Gracias
  #2 (permalink)  
Antiguo 04/12/2008, 17:00
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: ...XML....actualizable

Hola pablosky13,

Lo mejor es hacerlo de la forma correcta, echale un ojo a la extensión DOM_XML de PHP.

Saludos.
  #3 (permalink)  
Antiguo 08/12/2008, 09:41
Avatar de pablosky13  
Fecha de Ingreso: septiembre-2008
Mensajes: 42
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: ...XML....actualizable

Ya cabros.....hice una parte de este embrollo, pude generar el archivo.xml sin problemas con este codigo
Código PHP:
<?Php
$chao 
$_POST["chao"];

$arreglo_nombres=array(

"TITULO"=>$TITULO $_POST["TITULO"],
"LINK"=>$LINK $_POST["LINK"],
"RESUMEN"=>$RESUMEN $_POST["RESUMEN"],
"NOTICIACOMPLETA"=>$NOTICIACOMPLETA $_POST["NOTICIACOMPLETA"],

); 

$buffer='<?xml version="1.0" encoding="utf-8"?> 

   <!-- Generando XML...--> 
   
           <file_xml> <NOTICIA>'

           
  while (list (
$etiqueta$valor) = each ($arreglo_nombres)): 
  
$buffer.="<$etiqueta>$valor</$etiqueta>"
  endwhile; 
  
$buffer.="</NOTICIA>"
  
$buffer.="</file_xml>"
  
$file=fopen("archivo.xml","w+"); 
  
fwrite ($file,$buffer); 
  
fclose($file); 
?>
pero ahora, el tema es actualizarlo y sumarle datos.....para eso debia utilizar el codigo ke les mostre anteriormente (post anterior) y sumarlo al que les mostre ahora, porque se supone que funciona....pero no

Código PHP:
<?
$buffer
='<noticia>'
           
  while (list (
$etiqueta$valor) = each ($arreglo_nombres)): 
    
$buffer.="<$etiqueta>$valor</$etiqueta>"
  endwhile; 
  
$buffer.="</noticia>"
  
$buffer.="</file_xml>"
  
$file=fopen("archivo.xml","w+"); 
  
fwrite ($file,$buffer); 
  
fclose($file);
  
   if(
file_exists("archivo.xml")){
       
$archivo "archivo.xml";
       
$gestor fopen($archivo"a+");
       
fwrite($gestor"$buffer");
       
fseek($gestor0);
   } else {
       
$archivo "archivo.xml";
       
$gestor fopen($archivo"a+");
       
fwrite($gestor"<?xml version='1.0' encoding='iso-8859-1'?><informacion>");
       
fwrite($gestor"$buffer");
       
fwrite($gestor"</informacion>");
   }
?>
Gracias
  #4 (permalink)  
Antiguo 23/05/2014, 10:04
 
Fecha de Ingreso: mayo-2014
Mensajes: 1
Antigüedad: 9 años, 11 meses
Puntos: 0
Respuesta: ...XML....actualizable

ME PODEIS ALLUDAR EN ESTO QUIERO PONER MI LISTA XML actualizable

CON ESTO AVE SI ME PODEIS ALLUDAR UN POCO GRACIAS


<?xml version="1.0" encoding="utf-8" standalone="yes"?>


<channels>
<channels_info> <!-- this is optional -->
<title>TITULO DE LA LISTA</title> <!-- if channels_info, a title is required, other elements are optional -->
<genre>GENERO</genre>
<description>DESCRIPCION</description>
<thumbnail>URL DE LA IMAGEN DEL ICONO</thumbnail>
<fanart>URL DE LA IMAGEN DE FONDO</fanart>
<date>AÑO</date>
<credits>CREDITOS</credits>
</channels_info>

<channel>
<name>NOMBRE CATEGORÍA</name>
<info>DESCRIPCIÓN DE LA CATEGORÍA</info>
<thumbnail>URL DE LA IMAGEN DEL ICONO</thumbnail>
<fanart>URL DE LA IMAGEN DE FONDO</fanart>

<item>
<title>TITULO DEL CANAL</title>
<link>URL</link>
<thumbnail>URL DE LA IMAGEN DEL ICONO</thumbnail>
</item>

<item>
<title>TITULO DEL CANAL</title>
<link>URL</link>
<thumbnail>URL DE LA IMAGEN DEL ICONO</thumbnail>
</item>

<item>
<title>TITULO DEL CANAL</title>
<link>URL</link>
<thumbnail>URL DE LA IMAGEN DEL ICONO</thumbnail>
</item>

</channel>
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

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 23:40.