Hi all,
I need a way to serve 2 homepages, showing each 50% of the time. Is there a way to do it and how?
Thanks for reading this,
Igor
ps. I asked the same question before but probably the title wasn't motivating for anyone to read, so...
Serving random page
Re: Serving random page
One quick and dirty way to do it is just to define a tag to punt the user to a random page.
Soo... create a user defined tag called goRandomPage (or whatever you want to call it), with some code to pick a page based on a random number:
$goPage=(rand(1,2)==1) ? "Home1" : "Home2";
header("Location: index.php?page=".$goPage);
Then put the new tag {goRandomPage} in a page. When it loads it will pick either the page 'Home1' or 'Home2' (obviously you can change those to the names of the different pages you want to use) and just load the new page (in this case 'index.php?page=Home1' or 'index.php?page=Home2').
If you're using fancy url schemes then you'll have to change the way the page loads to match.
There. It's not pretty and there's probably a much nicer way to do it, but it works - and it's the best you'll get from me till I get some coffee made.
s.
Soo... create a user defined tag called goRandomPage (or whatever you want to call it), with some code to pick a page based on a random number:
$goPage=(rand(1,2)==1) ? "Home1" : "Home2";
header("Location: index.php?page=".$goPage);
Then put the new tag {goRandomPage} in a page. When it loads it will pick either the page 'Home1' or 'Home2' (obviously you can change those to the names of the different pages you want to use) and just load the new page (in this case 'index.php?page=Home1' or 'index.php?page=Home2').
If you're using fancy url schemes then you'll have to change the way the page loads to match.
There. It's not pretty and there's probably a much nicer way to do it, but it works - and it's the best you'll get from me till I get some coffee made.
s.
Re: Serving random page
Thanks scooper, seems exactly what I need 
Can I use the same technique to track outgoing clicks? If I create a different dummy page with just a redirect in it (implemented the same way like here), it would show in my website logs/statistics one should think!
Regards,
Igor

Can I use the same technique to track outgoing clicks? If I create a different dummy page with just a redirect in it (implemented the same way like here), it would show in my website logs/statistics one should think!
Regards,
Igor