Re: Random Flash Movies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 20, 2009 at 11:33 AM, Ashley Sheridan
<ash@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, 2009-09-20 at 11:30 -0400, Gary wrote:
>
>> A question was posted on another board that the poster wanted random flash
>> movies to display as the page is reloaded.  I posted the script below and
>> said I thought it could be adapted but that the echo would probably need to
>> change. Can someone offer some guidance on this?  Thanks
>>
>> Gary
>>
>> <?
>> //Chooses a random number
>> $num = Rand (1,6);
>> //Based on the random number, gives a quote
>> switch ($num)
>> {
>> case 1:
>> echo "";
>> break;
>> case 2:
>> echo "";
>> break;
>> case 3:
>> echo "";
>> break;
>> case 4:
>> echo "";
>> break;
>> case 5:
>> echo "";
>> break;
>> case 6:
>> echo "";
>> }
>> ?>
>>
>>
>>
>> __________ Information from ESET Smart Security, version of virus signature database 4441 (20090919) __________
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>
> Call the movies 1.swf, 2.swf it will make it easier. If not, put them in
> an associative array. Then, once the random number has been chosen,
> output all the code needed for embedding the Flash player, and in-place
> of the movie clip name, put your variable. The switch above is
> unnecessary, as it will mean a lot of duplication.
>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

What Ash said, something like:

$flashVids = array();
$flashVids[] = '/path/to/movie.swf';
$flashVids[] = '/different/path/movie.swf';
.... //add any amount more

$randomMoviePath = $flashVids[array_rand($flashVids)];

echo "Random flash movie: " . $randomMoviePath;

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux