Re: RANDOM
| From: | Richard Lynch | Date: | Thu, 09 Aug 2001 20:16:28 +0000 |
| Subject: | Re: RANDOM | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62078@lists.php.net to get a copy of this message | ||
>Could somebody please show me, send me an example or redirect me to a page
which shows how to >show a random FLASH movie from a text file which
contains different names of different movies >so that when i go on the page
it shows lets say, 1 of the 5 movies in the text document.
<?php
# Pick a movie, any movie:
$path = "/path/to/your/text/file/of/movie/URLs.txt";
$movies = file($path) or die("Could not open $path for reading.");
srand((double) microtime() * 1000000);
$index = rand(0, count($movies));
$movie = $movies[$index];
# Output the HTML to show that movie:
echo "<PARAM NAME=MOVIE NAME=$movie>";
?>
There's a lot more HTML to do a SWF properly than that, though, no...?
You can put as many movies as you want in your text file.
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm