Let’s say you have a spot for direct advertising on your blog. Instead of providing it for one advertiser you’d better provide a rotating banner. So you can sell the same spot for several others advertiser. It means more income for you.
How we can make a rotating banner? All you need to do is follow this simple step and place it on your blog. First upload your advertiser banner on your server. Write down the url for your banner. paste this code in your blog (the place you want the rotating banner exist):
<?php
session_start();
$links = array(
“<—-link1—->”,
“<—-link2—->”,
“<—-link3—->”,
);
$images = array(
“<—-image url1—->”,
“<—-image url2—->”,
“<—-image url3—->”,
);
$count = count($links) -1;
$randnum = mt_rand(0,$count);
if ($randnum == $_SESSION[‘randnum’])
{
$randnum = mt_rand(0,$count);
}
$_SESSION[‘randnum’] = $randnum;
echo ‘<a href=”‘.$links[$randnum].’”><img src=”‘.$images[$randnum].’” /></a>’;
?>
Insert your link and image url on the place that provide. Save it in php format. That’s it, now you have a rotating banner. Try to refresh your page just to see it working. And you can also add number of the link and the image by placing on the new link with the same format as above.