PDA

View Full Version : Randomly Rotate homepage on refresh


ptown
Feb 21, 2004, 12:13 PM
Here's a tricky one for ya.

I am putting together a collaborative site that will feature 4 different designers. Each designer has designed an individual splash page which consists of one image centered on the page, with a designated background color. Each page has a different image and background color. I am trying to figure out how I can have it so that when you go to the designated url, one of the 4 pages will randomly be the index page, then when the user refreshes it will randomly rotate an load another one of the four pages.

Any suggestions.

brianellisrules
Feb 21, 2004, 01:12 PM
write it in php.... make index.php just have an include line and randomize which file is selected....

<?
$num=rand(1,4);
include ("/homepage$num.".php"");
?>

homepage1.php through homepage4.php would be the page for each of your designers and it'll get randomly selected when the page loads.

(Note: I'm new to php, so I'm not sure if the above code will work without some trial-and-error to make sure the syntax is correct.)