Click to See Complete Forum and Search --> : Rotate Links Script Suggestion Please
howdy
07-28-2004, 02:54 PM
Hi,
Does anyone know of a perl script to rotate links each time the page is loaded?
I need rotating links not random links.
Random links scripts usually will have the same name on the link, but when people click on it, it will take them to a random page.
I need to be able for named links to rotate each time a person visits.
Any ideas on that would be greatly appreciated.
Thanks very much.
Yes, this can be done quite simply. I am a bit confused about what logic you want to employ, though, if the links are "NOT" to be random. Do you mean random links, but with a defined text link and associated page?
howdy
07-28-2004, 03:44 PM
Thanks for responding.
I will give an example and hopefully this makes it clear.
Name of Link: Avocado
URL: http://www.domain.com/avocado.html
Name of Link: Peach
URL: http://www.domain.com/peach.html
Name of Link: Apple
URL: http://www.domain.com/apple.html
I want to be able for when someone comes to the home page, they see the link "Avocado" and next time they visit the page or reload it, they see "Peach" link and next time "Apple" and so on.
Does this make it clear?
Thanks.
Originally posted by howdy
Does this make it clear?
...well, yes and no...
My question is... must the link show Avocado at first page load...and then Peach and then Apple...in that order...on successive page loads or...?
It matters, because the logic needed to accomplish this depends on your particular situation.
howdy
07-28-2004, 04:27 PM
I'm doing this for a client and it may matter to them what order they come in, but we can assume that it doesn't matter.
Also, it would probably be good if the script had an admin area that they could easily add links.
Or just an easy .txt file that they can edit would do I guess.
THANKS AGAIN FOR YOUR HELP
...something like the attached should do...
howdy
07-29-2004, 01:21 PM
Thank you CyCo VERY MUCH.
Did you write that one?
Is there anything I can do for you in return?
I need to have 2 separte instances of this running on one page. Can I have 2 scripts calling 2 different txt files?
Thanks.
Originally posted by howdy
Thank you CyCo VERY MUCH.
Did you write that one?
Is there anything I can do for you in return?
I need to have 2 separte instances of this running on one page. Can I have 2 scripts calling 2 different txt files?
Thanks.
you're welcome...
of course I wrote it...
...and yes you can run more than 1...just give the script and text file different names...
...I just spotted a tiny syntax error in the script...
this line should end with a semicolon
flock(LINX, LOCK_SH) || die $!;
...it would only produce an error if the file could not be locked...
sorry for the goof :(
howdy
07-29-2004, 06:43 PM
Thanks. I put the semicolon in there.
I haven't been able to try it out. I will let you know if I have any problems.
Take care.