Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Show a rotating banner ad for specific user id's Details »»
Show a rotating banner ad for specific user id's
Version: 1.00, by davis31b davis31b is offline
Developer Last Online: Jan 2012 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.7.x Rating:
Released: 06-03-2008 Last Update: Never Installs: 5
Template Edits
 
No support by the author.

This is a simple ad script that will enable you to place as many ads as you want into your forums, and this script will automatically rotate your banners for you so you won't clutter up the forums by having banners stacked on top of each other or side by side.

This will also make sure to only display the person viewing the forums if they are a member of:
Usergroup 1: Unregistered / Not Logged In
Usergroup 2: Registered Users

Also a small text link below the banner gives the user an incentive to click on the small link to become a paying member to disable the ads on your forums.

I'm also aware that VB has ad hooks installed, but many of us are using a custom style, so it makes it a little easier sometime to add scripts like this. I recommend using a banner ad (468 x 60) as pictured. You can also increase or decrease the number of banners it displays by changing: var how_many_ads = 3; & copying and pasting a new ad section within the javascript.

Find in header template: (usually at very bottom)

$ad_location[ad_header_end]

and after add:

Code:
<!-- Begin Ad -->
<if condition="is_member_of($bbuserinfo, 1,2)">
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<tr>
<td class="alt1" width="74%">
<script LANGUAGE="JavaScript">
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
if (ad==1) {
url="sendmessage.php";
alt="Banner Ad";
banner="/content/images/ad.png";
width="468";
height="60";
}
if (ad==2) {
url="http://tinyurl.com/5z999z";
alt="Targeted Website Traffic";
banner="http://www.buyawebsitetraffic.com/aff/banners/468x60_02.gif";
width="468";
height="60";
}
if (ad==3) {
url="http://www.somethingsexy.com";
alt="Somethingsexy.com";
banner="/content/images/somethingsexy.gif";
width="460";
height="60";
}
document.write('<center>');
document.write('<a href=\"' + url + '\" target=\"_top\">');
document.write('<img src=\"' + banner + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('alt=\"' + alt + '\" border=0><br>');
document.write('</center>');
</script>
<center>
<a href="payment.php"><font size="1" color="red">Purchase a subscription to make the forums ad free!</font></a>
</center>
</td>  
</tr>
</table>
</if>
<!-- End Ad -->
Replacements:
Text in red can be customized to better suite your forums.

*SCREEN SHOT ATTACHED*
Also please be aware that my site is [NWS].

-Enjoy!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 06-06-2008, 03:00 PM
fourat fourat is offline
 
Join Date: Mar 2008
Posts: 174
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks

is this code changing between the banners when i refresh the page ?
is this code make the pages Valid XHTML or not ?
Reply With Quote
  #3  
Old 06-06-2008, 06:15 PM
davis31b davis31b is offline
 
Join Date: Feb 2006
Location: Texas
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by fourat View Post
thanks

is this code changing between the banners when i refresh the page ?
is this code make the pages Valid XHTML or not ?

Yup, you only will see one banner at a time, everytime you refresh a new one will be there. You can add as many banners as you would like. As far as being a valid XHTML document, I guess to better answer that is this code works properly and am not having any issues at this time.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:49 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.03838 seconds
  • Memory Usage 2,215KB
  • Queries Executed 18 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete