vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Forum Home Enhancements - Banner Rotator Under Navbar (https://vborg.vbsupport.ru/showthread.php?t=238004)

pitrow 03-23-2010 08:59 PM

Quote:

Originally Posted by patrick91 (Post 2003929)
Hey,

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

Again, I have NOT tested this.

Johnny G 03-25-2010 09:38 AM

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


Bram H 12-02-2010 11:03 AM

If you want to use this code into the advertisement box, which part of the code should i use?

MatiasCandy 12-13-2010 06:13 PM

Fixed the link from above added \' instead of " so it will see it as outside link

with the
Code:

href="'+theLinks[whichImage]+'"
It saw the link as http://www.yourdomain.com/http://www.outsidedomain.com

with the with the
Code:

href=\''+theLinks[whichImage]+'\'
it will read it as http://www.outsidedomain.com


Code:

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

left the image part alone so it will read the root as http://www.yourdomain.com/

smooth-c 01-24-2011 10:21 PM

Strange question - but I'd like to have 3 random images displayed in a row - not just one. Linked of course.

How can I achieve this?

Thank you.

flaguns 03-17-2011 07:06 AM

Quote:

Originally Posted by MatiasCandy (Post 2133391)
Fixed the link from above added \' instead of " so it will see it as outside link

with the
Code:

href="'+theLinks[whichImage]+'"
It saw the link as http://www.yourdomain.com/http://www.outsidedomain.com

with the with the
Code:

href=\''+theLinks[whichImage]+'\'
it will read it as http://www.outsidedomain.com


Code:

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

left the image part alone so it will read the root as http://www.yourdomain.com/

I tried using this, and got nothing. Did I need to change anything else besides the image urls and the link urls?

sematopdemir 03-17-2011 08:24 AM

Thanks

yilmaz 03-26-2011 03:40 PM

Nice work thank you.
One question is this required?
Code:

<td align="$stylevar[left]">


All times are GMT. The time now is 08:33 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01184 seconds
  • Memory Usage 1,748KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete