Random File Selection.
Posted: Sun Jan 24, 2010 8:32 pm
I am pretty new to PHP and am trying to develop a theme for a Drupal website. I have 5 swf files (pic_x.swf where x is 1-5) The code I use to embed these files is:
My question is: how can I use PHP to generate a random number to replace "x" in "pic_x.swf" so that one of the 5 files is randomly selected and displayed each time the page loads?
Cheers.
Code: Select all
<embed type="application/x-shockwave-flash" src="<?php print $base_path . $directory; ?>/images/pic_x.swf" id="pic" name="pic" quality="high" wmode="transparent" width="300" height="150">Cheers.