rams it
Join Date: Oct 2004
Location: Seattle
|
Let's say I have 4 or 5 versions of the same homepage, how can I randomize it so when a user enters the address, there are a couple options as to what they'll see?
|
quote |
‽
|
You'll need server-side scripting, such as PHP, to do that.
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Or JavaScript if you don't mind forwarding the person to another page.
|
quote |
‽
|
True. Either way, it's rather simple to pull off. Of course, I'm a lazy bum and won't say how.
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Yeah, ditto. That's what Google's for.
|
quote |
rams it
Join Date: Oct 2004
Location: Seattle
|
Well, I guess it's not that important, I was just wondering. Thanks anyway.
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Well, here... I'll move this thread over to the Programmer's Nook where you may get a better response.
|
quote |
Veteran Member
Join Date: May 2004
Location: Ottawa, ON
|
Interesting idea Rasmits. But when I saw the title of this thread - and before I saw what you actually meant by the title - my mind immediately jumped to another interesting idea: being able to program your browser so that every time you opened it, it took you to a random place on the internet. I like that idea. You might want to set a few parameters in advance with respect to content (or not!). Broaden your horizons.
When there's an eel in the lake that's as long as a snake that's a moray. |
quote |
rams it
Join Date: Oct 2004
Location: Seattle
|
Thats a cool idea too, though, 90% of the results wouldn't be very flattering.
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Well, here's a quick and dirty way of doing what I think you want, rasmits.
[php]<?php $pages = array("index1.html","index2.html","index3.html","i ndex4.html"); $destination = rand(0,sizeof($pages)-1); header("Location:".$pages[$destination]); ?>[/php] Save that as index.php and it'll redirect the visitor to one of the links in the $pages array. Be sure you don't have anything before the opening "<?php" otherwise the redirect will fail. If you want the random page to appear to be at this location (ie. the user won't see a redirect and won't see the URL of the random pages), change it to work like this: [php]<?php $pages = array("index1.html","index2.html","index3.html","i ndex4.html"); $destination = rand(0,sizeof($pages)-1); include $pages[$destination]; ?>[/php] The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
rams it
Join Date: Oct 2004
Location: Seattle
|
Awesome, thank you very much.
|
quote |
Posting Rules | Navigation |
|
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Moving Frontpage website to .Mac Homepage? | bosox | Genius Bar | 0 | 2005-04-27 11:48 |
.Mac Homepage not responsive | Benners72 | Genius Bar | 5 | 2005-02-12 09:06 |
some random questions.. | ironlung | Third-Party Products | 9 | 2005-02-10 01:20 |
Random mac questions | porter | Genius Bar | 3 | 2005-01-23 14:37 |
random drug testing | Mac+ | AppleOutsider | 18 | 2004-12-14 08:28 |