Im trying to create a mp3 player that will add songs per day. So after long search over the net for months. Finally came up with an option, a flash player with a xml file which is controlled by a PHP code determining the date. since this is the first project im doing in PHP im totally lost.
Here is the xml for the flash player which I have downloaded
<?xml version="1.0" encoding="UTF-8"?>
<config>
<param name="mp3" value="tracks/2.mp3|tracks/1.mp3" />
<param name="title" value="Day 2|Day 1" />
<param name="height" value="150" />
<param name="width" value="250" />
.........
The first two children's "value" attribute should change per day.
And here is the PHP code I have come up with which doesn't work
$data = simplexml_load_file('tracks/list.xml');
$xml = new SimpleXMLElement($data);
foreach($xml->param[0]->attributes() as $name => $value)
foreach($xml->param[1]->attributes() as $name2 => $value2)
$today=date(d);
if($today==01){
$value.setAttribute("tracks/1.mp3");
$value2.setAttribute("Day 1");
echo $xml->saveXML();
}
if($today==02){
$value.setAttribute("tracks/2.mp3|tracks/1.mp3");
$value2.setAttribute("Day 2|Day 1");
echo $xml->saveXML();
}
if($today==03){
$value.setAttribute("tracks/3.mp3|tracks/2.mp3|tracks/1.mp3");
$value2.setAttribute("Day 3|Day 2|Day 1");
echo $xml->saveXML();
}
.........
Please help me out on how to fix this. Thanks