random link

i try to program a random link from a text to 3 to 4 pages ,
i would like each time i click the link to be redirect randomly to a set pages .
Is it possible how could i achieve that

Thanks

Patrick Mimran


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The Random Image Action can do this from an image, but I don’t know of an implementation that can do this from a text link. It wouldn’t be impossible to hack up that Action to make it do that, but if you want to do this from a text link you might find another approach quicker. Have a look at HotScripts, there may be something there in the JavaScript section. If you wanted to do it in PHP, here’s a really quick take on it:

<?php //up in the before /head section of your page function link(){ $r = rand(1,4); switch ($r) { case 1: return 'http://some.site.com'; break; case 2: return 'http://some.other.site.com'; break; case 3: return 'http://yet.another.site.com'; break; default: return 'http://wherever.com'; break; } } ?>

And then elsewhere in Freeway, you would manually enter this as your link HREF:

<?=link()?>

Obviously hack up the function to indicate your pages or sites, but when you click on the link one of four links will be chosen, and they’ll usually be different.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options