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);
?>