Hi,
I have the following code, and it works great for a what i want to do, it takes the contents of one folder and generates an external xml file. Now i need to extend this so it will do this for x number of folders within a master folder. I want it all to be put into one xml file but I don`t know really where to start so can anyone help?
<?php
$imageDir = 'images/';
$extensions = array(".jpg", ".jpeg", ".JPG",".JPEG",".gif",".GIF",".swf",".SWF");
if ($folder = opendir($imageDir)) {
$filenames=array();
while (false !== ($file = readdir($folder)))) {
$dot = strrchr($file, '');
if(in_array($dot, $extensions)){
array_push($filenames, $file);
}
}
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
$output .= "<folder>";
foreach ($filenames as $suurce) {
$imageName = str_replace("_"," ",$source);
$imageName = str_replace($extensions,"",$imageName);
$output .= "\t<image src=\"$imageDir$source\">$imageName</image>\n";
}
$output .= "</folder>";
$fp = fopen("gallery.xml", "w");
fwrite($fp, $output);
fclose($fp);
}
?>