$spaces $file
";
$new_folder = $new_file = str_replace("'", "%27", $folder);
//changes "'" to %27 so it can be interpreted by HTML in URL
echo "<~folder label=\"$quote$file\"$quote>
";
$myString1 = "\n";
fwrite($fh,$myString1);
//displays and outputs folder structure to xml file. Note: the HTML output will
// put a ~ in html tags ie <~file> so they will display on the screen.
getDirectory( "$path/$file", ($level+1) );
// Re-call this same function but on a new directory.
// this is what makes function recursive.
echo "<~/folder>
";
$myString2 = "\n\n";
fwrite($fh,$myString2);
//writes closing folder tag
} else {
//echo "$spaces $file
";
// Just print out the filename
if (substr($file, -3, 3) == "mp3" or substr($file, -3, 3) == "flv") //we only want mp3 files and not m3u and jpg
{
$new_file = str_replace("'", "%27", $file);
//changes "'" to %27 so it can be interpreted by HTML in URL
echo " <~file label=\"$quote$file\"$quote url=\"$quote$path/$file\"$quote> <~file>
";
//displays output to screen Note: the HTML output will put a ~ in html tags ie <~file> so they will display on the screen.
$myString3 = " \n";
fwrite($fh,$myString3);
//writes to XML file
}
}
}
}
closedir( $dh );
// Close the directory handle
//close($fh);
//close file writing
}
$fh=fopen('mcmp720x360_playlist.xml',"a");
$myString = "\n";
fwrite($fh,$myString);
echo "<~playlist>\n\n\n";
//writes the tag to the beginning of the file
/****EDIT THIS LINE TO YOUR MEDIA DIRECTORY****/
echo getDirectory( "files" );
// Get contents of the "files/includes" folder
$myString = "";
fwrite($fh,$myString);
fclose($fh);
echo "<~/playlist>";
//writes the tag to the end of the file
?>