Randomly Rotate homepage on refresh

Discussion in 'Web Design and Development (archive)' started by ptown, Feb 21, 2004.

  1. macrumors newbie

    ptown

    Joined:
    Jan 14, 2004
    #1
    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.
     
  2. macrumors regular

    Joined:
    Oct 17, 2003
    #2
    write it in php.... make index.php just have an include line and randomize which file is selected....
    PHP:
    <?
    $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.)
     

Share This Page