Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
Abyss is on a distinguished road
 
Posts: 3
Join Date: Jul 2008
Default Ad Rotation Script - 07-23-2008, 02:00 AM

I realize there is another ad rotation script out there already, but I feel that this one is a bit more efficient and easier to edit. Plus, this one's in php! Anyway, here it is:

PHP Code:
<?php
//The multidimentional array containing all of the ad info - this is the only place you edit
$ads = array(   
//          Image Source        Hyperlink Destination          Alt Text
=> array('images/ad1.png''http://www.yoursite.com''My Awesome Site'),
=> array('images/ad2.png''http://www.anothersite.net''Another Site'//...so on, so forth
);

//-------------------There's no need to edit anything beneath this point------------------------


//select a random ad from the array
$select rand(0count($ads) - 1);

//display the selected ad
echo '<a href="'.$ads[$select][1].'" target="_BLANK"><img src="'.$ads[$select][0].'" title="'.$ads[$select][2].'" /></a>';

?>
I hope it's helpful!

Last edited by Abyss : 07-23-2008 at 02:12 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0
vBulletin Skin developed by: vBStyles.com