oakbay
12-09-2005, 06:26 PM
I plan to set up a section on my site with a list of text links to other sites. I would like to be able to rotate the order of the links in the list, either randomly or by moving them up or down on a regular schedule. Does anyone know of a script that could be used to do this? The page in question is a .shtml, so a perl script with ssi would be perfect. TIA.
01globalnet
12-09-2005, 06:53 PM
Hi,
some ready scripts - check this
http://hotscripts.com/PHP/Scripts_and_Programs/Randomizing/Random_Links/index.html
I hope you find something useful and integrate to your site. Although the above scripts are written in PHP, I think you will not have any problems with .shtml pages - you must add a line into .htaccess
AddType application/x-httpd-php .shtml
This is generally quite easy thing to setup some random links even if you like to code it on your own - I recommend in php!
oakbay
12-09-2005, 07:11 PM
Thanks for repying, Tony. I looked at those kind of scripts, but they generally pick a random URL from a list of URL's stored in a text file of db. What I want is a script that will randomize the order of a list of links on a page every so often.
01globalnet
12-09-2005, 07:41 PM
something in PHP that works fine:
$my_links = array();
$my_links[1]["Website 1"] = "http://www.website1.com";
$my_links[2]["Website 2"] = "http://www.website2.com";
$my_links[3]["Website 3"] = "http://www.website3.com";
.
.
$my_links[100]["Website 100"] = "http://www.website100.com";
shuffle($my_links);
for ($i = 1; $i < 10+1; $i ++) { //show 10 links
$website_title = key($my_links[$i]);
$website_url = $my_links[$i][$website_title];
echo "<a href=\"$website_url\" target=\"_blank\">$website_title</a><br>";
}
obviously you need to edit the php array to add/edit/delete links... you can keep it in a separate include file to keep the code clean... or if you like you can add a backend with admin pages+mysql !!