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..
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..