Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-14-2007, 11:59 PM
mfarmerhi mfarmerhi is offline
 
Join Date: Apr 2003
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using OpenAds / PhpAdsNew for a Specific Banner for Each Forum

I would like to use OpenAds to serve a different banner for each sub-forum.

I need help figuring out how to include the following php code into a global_start hook:
Code:
$banner[3] = "<script language='JavaScript' type='text/javascript' src='http://216.120.234.168/~totalli/ads/adx.js'></script>
<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\");
   document.write (\"http://216.120.234.168/~totalli/ads/adjs.php?n=\" + phpAds_random);
   document.write (\"&amp;what=zone:1\");
   document.write (\"&amp;exclude=\" + document.phpAds_used);
   if (document.referrer)
      document.write (\"&amp;referer=\" + escape(document.referrer));
   document.write (\"'><\" + \"/script>\");
//-->
</script><noscript><a href='http://216.120.234.168/~totalli/ads/adclick.php?n=adb694ca' target='_blank'><img src='http://216.120.234.168/~totalli/ads/adview.php?what=zone:1&amp;n=adb694ca' border='0' alt=''></a></noscript>"
I've successfully used this method to display a different banner in each specific forum with vB 3.0.x as detailed in this thread on vB.com, but that hack had the php variables defined in the phpinclude_start template (which no longer exists in 3.5).

That thread suggests including the php variable definitions in global_start as a hook, but thus far simply including the code above doesn't seem to work.

Finally figured out how to do it with the current "hook" system. This method assumes you have both vB and OpenAds (or PhpAdsNew) installed. This method uses OpenAds (PhpAdsNew) remote Javascript invocation method.

With OpenAds (PhpAdsNew), assign a separate zone for each forum or sub-forum you'd like a specific banner displayed in. OpenAds (PhpAdsNew) will provide the javascript invocation code.

In your vB admin panel hooks system, add a new hook:

Product: vBulletin
Hook Location: global_start
Title: Banners
Plugin PHP Code: (Assign the variable $banner[x] with the invocation code as given by OpenAds, "x" being the Forum id (visible during mouse over on each forum or sub-forum's link). Here I've used mine as an example: )
Code:
$banner[3]="<script language='JavaScript' type='text/javascript' src='http://216.120.234.168/~totalli/ads/adx.js'></script>
<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\");
   document.write (\"http://216.120.234.168/~totalli/ads/adjs.php?n=\" + phpAds_random);
   document.write (\"&amp;what=zone:1\");
   document.write (\"&amp;exclude=\" + document.phpAds_used);
   if (document.referrer)
      document.write (\"&amp;referer=\" + escape(document.referrer));
   document.write (\"'><\" + \"/script>\");
//-->
</script><noscript><a href='http://216.120.234.168/~totalli/ads/adclick.php?n=af212c0e' target='_blank'><img src='http://216.120.234.168/~totalli/ads/adview.php?what=zone:3&amp;n=af212c0e' border='0' alt=''></a></noscript>";
Plugin is active: Yes

Add in additional $banner[x]= with the OpenAds generated invocation code to define each forum (using the forumid #s in place of "x"). When using the Javascript invocation method of phpAds / OpenAds, include the invocation code in quotes, ending it with a semi-colon (apparently correct syntax for php... but who am I to say, I'm a php newb...)

Use $banner[$forumid] in whatever template you'd like your banners displayed. In FORUMDISPLAY, it works well directly under $navbar encased in "div"s as such
Code:
<!--ad integration hack -->
<div align=center>$banner[$forumid]</div><br>
<!-- end ad hack -->
Reply With Quote
 


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 01:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03698 seconds
  • Memory Usage 2,310KB
  • Queries Executed 12 (?)
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
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)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
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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