»»»
Random URL/ LINK using php
This simple example shows you how to display random
links on your website using php. Excellent for making
dynamic content on a website or generating income from
you revenue partners by rotating their text links.
Code Example:
<?php // the urls you want
to randomize
$urls = array("http://www.flashgimp.com"
,
"http://www.motionrush.com" ,
"http://www.sarasotabradentonvenice.com"
);
//the titles of the URLS you want to randomize
$titles = array("Flashgimp Tutorials" ,
"Motionrush Media Labs" ,
"Sarasota Bradenton Venice Portal");
//generate a random number
srand(time());
$random = (rand()%3);
//display the links
echo ("<a href = \"$urls[$random]\">$titles[$random]</a>");
?>
And here is the output , refresh
your browser to see all the random links.
»»»
Flashgimp Tutorials
You can drop this snippet anywhere
you like, but the page you put it into must be able
to parse PHP code. So it should end in *.php ( you
would also add your CSS to comply with your design
)