Click to See Complete Forum and Search --> : rotating music each hit
jmoreau
09-23-2005, 08:17 PM
I'm wondering if this can be done. I have a web page with a bunch of pictures from a recent vacation we all went on. We heard the same 3 songs everywhere we went. I want to rotate between the 3 different songs using the embed tag so that each hit to the page it will play a different song.
Kinda like rotating images i would presume, just haven't found the right code yet. Anyone have any ideas?
TIA,
Josh
conputerguy99
09-23-2005, 08:45 PM
Here is the code you will need.
<?php
$rand = rand(1,3);
if($rand == 1){print "<embed src="file1.extension" autostart='true' hidden='true' />";}
elseif($rand == 2){print "<embed src="file2.extension" autostart='true' hidden='true' />";}
elseif($rand == 3){print "<embed src="file3.extension" autostart='true' hidden='true' />";}
?>
Just put this on your webpage and your webpage will need a .php extension instead of .htm or .html.
laxplayacs
09-24-2005, 08:33 PM
can u only do this in php? or does it work in other things too(liuke HTML?)
jmoreau
09-26-2005, 09:20 AM
When I renamed it to have the extension .php, and other people try to look at that page, their browser tries to save it to disk. Is there anything I'm missing? I just put the php code in the body section of the page, does that matter?