Posted by Nick on 11/02/06 11:11
Many thanks.
It works fine.
Nick
Kim André Akerø ha scritto:
> 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)]);
> ?>
>
[Back to original message]
|