Simple PHP banner rotator for you all

Status
Not open for further replies.

roadrunner

Active Member
600
2011
127
0
1 simple file :

Code:
<?php
$advert = array(); 

$advert[] = '<a href="#" target="_blank"><img src="#"></a>';
$advert[] = '<a href="#" target="_blank"><img src="#"></a>';
$advert[] = '<a href="#" target="_blank"><img src="#"></a>';
$advert[] = '<a href="#" target="_blank"><img src="#"></a>';
$advert[] = '<a href="#" target="_blank"><img src="#"></a>';

shuffle($advert); 
echo $advert[0];
?>

Call it what ever you-want.php and alter the links to suit your needs, you can add as many links as you wish.

Then add this to where you want to display the banners:

Code:
<?php include("your-file.php"); ?>

Change the above from your-file.php to what ever you called the file

Upload the file to your server and thats it

Hope that helps a little, its a noob script but it works, please feel free to develop

Cheers
RR
 
6 comments
Hey
Thanks for this and sorry for the bump
Can any one add rotating value to this script like one add will run 30% and other will 70%
thanks
 
This ad only runs once until the screen is refreshed . Not a continous rotation.

Besides how would ou decide the 30% vs 70%? Run one 3 times than the next 7 times?
 
Status
Not open for further replies.
Back
Top