vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=155)
-   -   Rotating banners (https://vborg.vbsupport.ru/showthread.php?t=106682)

attroll 01-29-2006 10:00 PM

Rotating banners
 
I created this simple and easy hack for a rotating banner block. All you have to do is create a template and add a plugin location and your done.

1. Go to your ADMINCP and create a template called "banner" and insert the attacked code:
PHP Code:

<!-- Begin rotating ad code -->
<
script language="Javascript"><!-- 
function 
image() { 
}; 
image = new image(); 
number 0
// imageArray 
image[number++] = "<a href='http://www.yoursite.net/forum/payments.php'><img src='http://www.yoursite.net/forum/sponsors/donatebanner.gif' border='0'></a>"
image[number++] = "<a href='http://www.hikersupply.com'><img src='http://www.yoursite.net/forum/sponsors/hikersupply.gif' border='0'></a>"
image[number++] = "<a href='http://www.modelt.net'><img src='http://www.yoursite.net/forum/sponsors/modeltbanner.gif' border='0'></a>"
image[number++] = "<a href='http://appalachiantrailservices.com/'><img src='http://www.yoursite.net/forum/sponsors/atservicesbanner.gif' border='0'></a>"
image[number++] = "<a href='http://www.thepacka.com/'><img src='http://www.yoursite.net/forum/sponsors/cedartreebanner.gif' border='0'></a>"
// Carry on adding images - as many as you want
increment Math.floor(Math.random() * number); 
document.write(image[increment]); 
//-->
</script>
<!-- 
End rotating ad code --> 

2. Now still in your ADMINCP go to PLUGIN SYSTEM-->ADD NEW PLUGIN
HOOK LOCATION is "global_start"
TITLE is "banner"
PLUGIN PHP CODE:
PHP Code:

eval('$banner = "' fetch_template('banner') . '";'); 

Do not forget to make the plugin active.

3. Now you can go into any template you want and where ever you put the $banner your rotating banners will appear.

4. Most people want to put this in the top right corner of the forums. If this is what where you want it then. go into you ADMINCP templates and into you header:

Find:
PHP Code:

<td align="$stylevar[right]">
&
nbsp

Under that insert:
PHP Code:

$banner 

Now you done. All you have to do is edit your template your created with the links and banners you want to use.

You can add more rotating banners then what is in the code. All you have to do in insert more lines with banners in the right location in the code. That should be self explanatory.

Note:
You can make your link open in a seperate browser window by adding the target='ad' in the line as shown below.
PHP Code:

image[number++] = "<a target='ad' href='http://www.hikersupply.com'><img src='http://www.yoursite.net/forum/sponsors/hikersupply.gif' border='0'></a>" 


Dreamchaser 01-30-2006 01:57 AM

Seems Interesting and something that I needed to add to my forums!
Thanks for the hack :)!

* First to Install :D

Dreamchaser 01-30-2006 02:22 AM

I have one small suggestion or you may call it a request !

You have provided a way to add images and link them to various sites, what if I wanted to add various codes like, google adsense, yahoo and other publisher codes which provide them as JavaScript, and I need to add 5 such codes, so each time the page loads, different ads appear.

Any help on this ? Thanks in advance ! Btw, I installed this and works fine :)

Regards,
DC

icare 01-30-2006 02:52 AM

I did exactly what is dictated above but cant see any banners..... :ermm:

attroll 01-30-2006 02:58 AM

Quote:

Originally Posted by Dreamchaser
I have one small suggestion or you may call it a request !

You have provided a way to add images and link them to various sites, what if I wanted to add various codes like, google adsense, yahoo and other publisher codes which provide them as JavaScript, and I need to add 5 such codes, so each time the page loads, different ads appear.

Any help on this ? Thanks in advance ! Btw, I installed this and works fine :)

Regards,
DC

If you using google adsense then you have no choice what ads appear anyways. They are random ads and read the content of your site to pick what ads are displayed. I don't know much about Yahoo because they are still in the test stages and I can not find where to apply for them to get them. I would like to get Yahoo ads so I could answer you question and use them. But I would be willing to bet that they work on the same principle as google adsense.

If you could explain more about what you mean I could probably answer your question better.

CAMS 01-30-2006 03:43 AM

just wat i was looking for after some other code wasnt working properly :)

cheers and installed

CopoGuy 01-30-2006 04:43 AM

Awesome (and simple) mod! Thank You!

Has anyone tried to add the target="_blank" piece to the banner's URL (so it opens the banner link in an external browser window?)
example:
Code:

// imageArray
image[number++] = "<a href='http://www.bannerurl.com" target="_blank">

The default script works great but when I try to do it that way the banner disappears on the forum page. Perhaps I have a typo?

attroll 01-30-2006 03:17 PM

Quote:

Originally Posted by CopoGuy
Awesome (and simple) mod! Thank You!

Has anyone tried to add the target="_blank" piece to the banner's URL (so it opens the banner link in an external browser window?)
example:
Code:

// imageArray
image[number++] = "<a href='http://www.bannerurl.com" target="_blank">

The default script works great but when I try to do it that way the banner disappears on the forum page. Perhaps I have a typo?

You can make it open in a seperate browser window by adding the target='ad' in the line as shown below. Sorry I did not explain that. I left it out because I wanted to make this hack very easy.

PHP Code:

image[number++] = "<a target='ad' href='http://www.hikersupply.com'><img src='http://www.yoursite.net/forum/sponsors/hikersupply.gif' border='0'></a>" 

I have just added this to the documentation.

LisaD1 01-30-2006 03:47 PM

Installed and works great!! Thanks

LEAD_WEIGHT 01-30-2006 03:56 PM

Does this not do the same? or does yours have more unique qualities?
http://www.vbulletin.com/forum/showthread.php?t=170826


All times are GMT. The time now is 04:34 AM.

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.15231 seconds
  • Memory Usage 1,758KB
  • 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
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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