Problem with XML Generated by PHP
Posted: Fri Mar 06, 2009 6:35 pm
Hi,
I have a little problem with a XML file generated with PHP.
I´m making a Flash Gallery that loads the path of the images and thumbnails.
And I have the Admin side that makes an interesting function: It uploads a photo and makes the thumbnail and resizes the original.
The Flash gallery loads a php file that output something like this:
Well this is perfect, because Flash loads all the images with their respective thumbnails, the thing I want to do is to remove the first two image nodes, and the "thumbs" node. Because it confuses the gallery and make it load "blank images".
So I ask a way to remove the nodes before they are generated, I use this code:
Thank you very much 
I have a little problem with a XML file generated with PHP.
I´m making a Flash Gallery that loads the path of the images and thumbnails.
And I have the Admin side that makes an interesting function: It uploads a photo and makes the thumbnail and resizes the original.
The Flash gallery loads a php file that output something like this:
Code: Select all
<?xml version="1.0" encoding='UTF-8'?>
<gallery>
<image>.</image>
<image>..</image>
<image>arches-11.jpg</image>
<image>archipelago-5.jpg</image>
<image>ardara.jpg</image>
<image>brook.jpg</image>
<image>climbing-moss.jpg</image>
<image>los-angeles-skyline.jpg</image>
<image>mountain-109.jpg</image>
<image>thumbs</image>
<image>yosemite-stream.jpg</image>
</gallery>
So I ask a way to remove the nodes before they are generated, I use this code:
Code: Select all
<?php
$dir = opendir("images");
echo "<?xml version=\"1.0\" encoding='UTF-8'?>\n";
echo "<gallery>\n";
while (($file = readdir($dir)) !== false)
{
echo "<image>" . $file . "</image>\n";
}
echo "</gallery>\n";
closedir($dir);
?>