OK - I've noticed multiple posts asking for help on this, so I came up with a function that will auto select a swf file from a directory accoring to the day. There might be a few bugs in there and might select one out of order once in a while, but all-in-all, it should work.
Also it will change when you add or remove files in the directory.
The PHP Function:
PHP Code:
<?php function swf_rotator () { // Relative path to swf files (i.e. ./swf/) with trailing slash $swf_path = './swf/'; $file_array = Array(); if ($s_dir = @dir($swf_path)) { while ($s_file = $s_dir->read()) { if (strstr($s_file, '.swf')) { $file_array[] = $s_file; } } } return $swf_path . $file_array[floor(time() / 86400) % count($file_array)]; } ?>
The HTML:
PHP Code:
<object> <param name="movie" value="<?php echo swf_rotator(); ?>" /> <param name="quality" value="high" /> <embed src="<?php echo swf_rotator(); ?>" quality="high" type="application/x-shockwave-flash" swliveconnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
Last edited by mgraphic; 10-29-2006 at 07:32 PM..
Reason: Seen mistake
|