Hi,
I have been scratching my head trying to figure this out… sadly I haven’t. I’m sure this is something simple; please help me out.
using PHP I would like to list all the files in a specified folder in a random sequence. And output this as an xml file. Here’s what I have so far…
<?
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
echo "<songs>
";
/////////////////////////////////////////////////////////////////////////////////////
$file_dir="mp3";
////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
$dir=opendir($file_dir);
while ($file=readdir($dir))
{
if ($file != "." && $file != "..")
{
list($name, $ext) = explode(".", $file);
list($artist, $title) = explode("-", $name);
echo "<song path=\"".$file."\" artist=\"".$artist."\" title= \"".$title."\"></song>
";
}
}
echo "</songs>
";
?>
How can I modify this to generate a random list.
Thanks!