PDA

View Full Version : -Alpha- Banner Rotation Script


Eternal2u
02-22-2005, 10:00 PM
I know it's been posted by someone else for the banner rotation controlable by the acp, etc...but this is my own little version with only 1 template to edit...


First this was originally made by Reece on www.GamesXposed.com to generate cash to support the server costs....

Time to start the mod..

##########Edit headinclude##########


##Find##

<script type="text/javascript" src="clientscript/vbulletin_global.js"></script>
<if condition="$show['popups']"><script type="text/javascript" src="clientscript/vbulletin_menu.js"></script></if>

##After Add##

<SCRIPT LANGUAGE="javascript">
<!-- Copyright
//
function banner(img_source,url,alt,chance) {
this.img_source = img_source;
this.url = url;
this.alt = alt;
this.chance = chance;
}
function display() {
with (this) document.write("<A HREF=" + url + "><IMG SRC='" + img_source + "' WIDTH=468 HEIGHT=60 BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.display = display;
banners = new Array();
banners[0] = new banner("http://canaca.com/Banner10.gif",
"http://www.canaca.com/affiliate/link.php?ref=173&productid=1 target='_blank'",
"Canaca Inc",
10);
banners[1] = new banner("http://gamesxposed.com/cheat.gif",
"http://www.cheatnexus.net/ target='_blank'",
"Cheat Nexus",
10);
sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
sum_of_all_chances += banners[i].chance;
}
function display_banner() {
chance_limit = 0;
randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
for (i = 0; i < banners.length; i++) {
chance_limit += banners[i].chance;
if (randomly_selected_chance <= chance_limit) {
document.write("<A HREF=" + banners[i].url + "><IMG SRC='" + banners[i].img_source + "' WIDTH=468 HEIGHT=60 BORDER=0 ALT='" + banners[i].alt + "'></A>");
return banners[i];
break;
}
}
}
//-->
</SCRIPT>

##End - Save Template File##


-Explnation-

obviously on

banners[0] = new banner("http://mysite.com/bannerlocation.jpg",
"http://advertiserurllocation.com target='_blank''",
"Advertiser's Name",
10);
banners[1] = new banner("http://mysite.com/bannerlocation.gif",
"http://advertiserurllocation.com target='_blank'",
"Advertiser's Name",
10);

each new banner would simply copy

banners[1] = new banner("http://mysite.com/bannerlocation.gif",
"http://advertiserurllocation.com target='_blank'",
"Advertiser's Name",
10);

that and replace the mysite.com/bannerlocation.gif with the picture/banner they wanted for it..also would replace http://advertiserurllocation.com witht he actually person's url and lastly Advertiser's Name with the name of the site there advertising for..

Will possibly come back with acp options and build it into the acp to make it easier for users to change it awithout diving in the template system..

Durtay
02-23-2005, 10:14 PM
It's always helpful to have screenshots and to have the coding in a downloadable format. Nice hack.

Eternal2u
02-24-2005, 03:43 AM
post deleted by et2u

steadicamop
02-25-2005, 01:15 PM
For whatever reason, this doesn't work for me, I copied the code into the headinclude and it does nothing, should there be anything anywhere in some other code? I suppose it could be the template I'm using.

Thanks, cracking hack, hopefully will get it working :)

Jason

hollyboy
02-25-2005, 04:06 PM
for when this hack will become Full Release?
I think it's agood hack and I was actually looking for something like this

Eternal2u
02-26-2005, 11:46 AM
jasonwilliams not sure what your prob is man..

mind copying your headerinclude code here so i can look and compare whats what..

Also i will probably not release another version of this ever for vBulletin..

I'm moving to phpBB 2.0.12 by the end of the weekend and abandoning vBulletin due to there unfair practices with linking off my server to questionable content

So see you guys on phpBB.com 's official community boards..

May vBulletin rot in hell.

hollyboy
02-27-2005, 07:19 AM
so does thi work?

Brad
03-09-2005, 12:04 AM
I'm moving to phpBB 2.0.12 by the end of the weekend and abandoning vBulletin due to there unfair practices with linking off my server to questionable content

If by questionable content you mean warez then jelsoft has every right to take any action they please, read the license agreement.

vinnycuz
04-13-2005, 01:09 AM
hack did nothing...