The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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 (\"&what=zone:1\"); document.write (\"&exclude=\" + document.phpAds_used); if (document.referrer) document.write (\"&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&n=adb694ca' border='0' alt=''></a></noscript>" 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 (\"&what=zone:1\"); document.write (\"&exclude=\" + document.phpAds_used); if (document.referrer) document.write (\"&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&n=af212c0e' border='0' alt=''></a></noscript>"; 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 --> |
#2
|
||||
|
||||
So it's working now?
|
#3
|
|||
|
|||
Yea, thanks for checking. Shortly after posting my question I figured out where the problem was.
I've edited my original post to hopefully detail how others can accomplish this as it appears to be a popular topic. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|