Posted by Kim Andrι Akerψ on 11/02/06 09:54
Nick wrote:
> Hi,
>
> I've an image and a phrase in my home page (index.php) and I'd like
> to change them randomly each time the page is reloaded. To achieve
> this goal, I've created a folder and in this folder I've inserted
> different php files: each file include a different image and an
> associated phrase. Now I'd like to create in the index.php a script
> that each time the page is reloaded includes randomly a php file from
> the folder. The result should be that each time the page is reloaded
> the image and the phrase change. Can you help me please? Many
> thanks for the support.
One way to do it:
<?php
$filelist = glob("dirwithphpfilestoselectatrandom/*.php");
include($filelist[array_rand($filelist)]);
?>
--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Navigation:
[Reply to this message]
|