Here's my code:
<embed src="/sound/lowyourchicken.mp3"
width="140" height="40" autostart="true" loop="TRUE">
</embed>
I would like the src for the .mp3 to take in to account that there are many randomly named .mp3 files in the /sound/
directory, and to choose one at random each time the page is opened. Any clues for me?
My server is PHP enabled but I'd like to keep this as simple as possible.
This should do it:
$files = glob("/path/to/directory/*.mp3");
$random = array_rand($files)
Then do this:
<embed src="<?php echo $random ?>"
width="140" height="40" autostart="true" loop="TRUE">
</embed>