Tema: XML y PHP
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/08/2008, 13:03
Avatar de juanleonardo
juanleonardo
 
Fecha de Ingreso: agosto-2007
Mensajes: 382
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: XML y PHP

De aca, saque lo q queria hacer,pero este articulo no dice si hay q guardarlo como php o como xml, pero yo probe con ambos pero no funciono y el archivos quedo algo asi:
gallery.xml (.php?)
Cita:
<?php
header("Content-type: text/xml");

$host = "localhost";
$user = "root";
$pass = "";
$database = "imagenes";

$enlace = mysql_connect($host, $user, $pass) or die("Error MySQL.");
mysql_select_db($database, $enlace) or die("Error base de datos.");

$query = "SELECT * FROM tb_imagenes ORDER BY id ASC";
$resultado = mysql_query($query, $enlace) or die("Sin resultados.");

$salida_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$salida_xml .= "<simpleviewerGallery maxImageWidth=\"480\" maxImageHeight=\"480\" textColor=\"0xFFFFFF\" frameColor=\"0xffffff\" frameWidth=\"20\" stagePadding=\"40\" thumbnailColumns=\"3\" thumbnailRows=\"3\" navPosition=\"left\" title=\"\" enableRightClickOpen=\"true\" backgroundImagePath=\"\" imagePath=\"\" thumbPath=\"\">\n";

for($x = 0 ; $x < mysql_num_rows($resultado) ; $x++){
$fila = mysql_fetch_assoc($resultado);
$salida_xml .= "\t\t<filename>" . $fila['i_direccion'] . "</filename>\n";
$salida_xml .= "\t\t<caption>" . $fila['i_descripcion'] . "</caption>\n";
}

$salida_xml .= "</simpleviewerGallery>";

echo $salida_xml;

?>
El archivo q lo invoca es:
Cita:
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>

<div id="flashcontent">SimpleViewer requires Macromedia Flash. <a href="http://www.macromedia.com/go/getflashplayer/">Get Macromedia Flash.</a> If you have Flash installed, <a href="conoceLedesma.php?detectflash=false">click to view gallery</a>.</div>
<script type="text/javascript">
var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "7", "#181818");
fo.addVariable("preloaderColor", "0xffffff");
fo.addVariable("xmlDataPath", "gallery.xml");
fo.write("flashcontent");
</script>

</body>
</html>
Esto para una galeria de imagenes
Gracias por la ayuda