Version: 1.00, by mavigul
Developer Last Online: Apr 2012
Category: Forum Home Enhancements -
Version: 4.0.2
Rating:
Released: 03-10-2010
Last Update: Never
Installs: 23
Template Edits
No support by the author.
Banner Rotater under Navbar
find in navbar:
PHP Code:
</div><!-- closing div for above_body -->
add under:
PHP Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin Random Logo In Header Script
var theImages = new Array() // do not change this
<!-- Edit the url images to match yours
theImages[0] = 'imageurl'
theImages[1] = 'imageurl'
theImages[2] = 'imageurl'
theImages[3] = 'imageurl'
theImages[4] = 'imageurl'
theImages[5] = 'imageurl'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<div align="center"><img src="'+theImages[whichImage]+'" border="0" alt="{vb:raw vboptions.bbtitle}" /></a></div>');
}
// End -->
</script>
Is it possible to put the code in de default option in vB4 that advertising option and adsense!???
A small little change but it should work, though I have not tested it...
changes / additions in bold
Code:
...
var whichImage = Math.round(Math.random()*p);
function showImage(){
if (whichImage == p)
document.write(google_adsense_code_here);
else
document.write('<div align="center"><img src="'+theImages[whichImage]+'" border="0" alt="{vb:raw vboptions.bbtitle}" /></a></div>');
}
// End -->
...
what it does is allows the random number to include 1 higher than the index of the array, then it checks if that number IS outside the array and prints the google adsense code, otherwise just prints the regular image
If you want to add links to the banners into new windows
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin Random Logo In Header Script
var theImages = new Array() // do not change this
var theLinks = new Array() // set up the container for the links
<!-- Edit the url images to match yours
theImages[0] = 'banner1.png'
theLinks[0] = 'http://link1.com'
theImages[1] = 'http://www.banner2.gif'
theLinks[1] = 'http://www.link2.net'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<div align="center"><a href="'+theLinks[whichImage]+'" target="_blank"><img src="'+theImages[whichImage]+'" border="0" alt="{vb:raw vboptions.bbtitle}" /></a></div>');
}
// End -->
</script>
<!-- logo -->
<a name="top"></a>
<td align="$stylevar[left]"><a href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}"><SCRIPT LANGUAGE="JavaScript">
showImage();
</script>
<!-- /logo -->
<!-- Banner Ad Add-on Start -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin Random Logo In Header Script
var theImages = new Array() // do not change this
var theLinks = new Array() // set up the container for the links
<!-- Edit the url images to match yours
theImages[0] = 'images/banners/00001.jpg'
theLinks[0] = 'http://www.00001.net'
theImages[1] = 'images/banners/00002.gif'
theLinks[1] = 'http://www.00002.com'
theImages[2] = 'images/banners/00003.gif'
theLinks[2] = 'http://www.00003.com'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<div align="center"><a href=\''+theLinks[whichImage]+'\' target="_blank"><img src="'+theImages[whichImage]+'" border="0" alt="{vb:raw vboptions.bbtitle}" /></a></div>');
}
// End -->
</script>
<!-- logo -->
<a name="top"></a>
<td align="$stylevar[left]"><SCRIPT LANGUAGE="JavaScript">
showImage();
</script>
<!-- Banner Ad Add-on End -->
<!-- Banner Ad Add-on Start -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin Random Logo In Header Script
var theImages = new Array() // do not change this
var theLinks = new Array() // set up the container for the links
<!-- Edit the url images to match yours
theImages[0] = 'images/banners/00001.jpg'
theLinks[0] = 'http://www.00001.net'
theImages[1] = 'images/banners/00002.gif'
theLinks[1] = 'http://www.00002.com'
theImages[2] = 'images/banners/00003.gif'
theLinks[2] = 'http://www.00003.com'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<div align="center"><a href=\''+theLinks[whichImage]+'\' target="_blank"><img src="'+theImages[whichImage]+'" border="0" alt="{vb:raw vboptions.bbtitle}" /></a></div>');
}
// End -->
</script>
<!-- logo -->
<a name="top"></a>
<td align="$stylevar[left]"><SCRIPT LANGUAGE="JavaScript">
showImage();
</script>
<!-- Banner Ad Add-on End -->