The vB Geek

Go Back   The vB Geek > vB Geek Modifications > Tutorials

Tutorials Tutorials and articles on using vB Geek stuff.

Advertisement
  Learn how to remove ads

Comment
 
Tutorial Tools Display Modes
Ad after first post
Ad after first post
How to get GAB ads to appear after x amount of posts
Published by The Geek
03-08-2007
Default Ad after first post

Getting GAB to appear in between x amount of posts is simple and easy.

This tutorial assumes that you have GAB set up and configured (including the banner you want to show).

1. Create a plug in.

Since posts are created in a private function within vB, you must scope $GAB_ads. That way, your $GAB_ads[x] variable will be available in your postbits. We will also scope $counter which increases by one for each visible post on that page.

go to admincp->Plugins & Products->Add new plugin

Product: vBulletin (or GAB )
Hook Location: postbit_display_start
Title: GAB ad between posts
Plugin PHP code:
PHP Code:
global $GAB_ads$counter
Plugin is active: Yes

2. Modify your postbit template (this is the postbit or postbit_legacy template, whichever one you are using).

We need to stick a conditional at the end of the postbit that says 'if this is the first post, then show $GAB_ads[x]. Note that you will need to change the x in $GAB_ads[x] to denote the billboard you are using (see admincp-> gab ->scripts->MASTER script to see which billboard is assigned). Also note that you can change the $counter == 1 in the statement below to denote where to show the banner . For instance if it were change to 3, then a banner would appear after the third post on the page.

Place the following HTML at the very end of your postbit:

HTML Code:
<if condition="$counter == 1"><if condition="THIS_SCRIPT!='private'"><div style="padding-top:5px">$GAB_ads[x]</div></if></if>
Note that I have put in a provision so that the banner will NOT appear after a private message. Depending on your style and the size of the banners, the sidebar in the usercp can whack out the look.

HTHs!
Tutorial for
GAB

Tutorial Tools
Show Printable Version  Email this Page 

  #1  
By phlogiston on 04-12-2007, 12:39 AM
Default

I spent half an hour trying to figure this myself then two minutes searching vbgeek.com for an answer and about thirty seconds implementing this.

Works like a charm
Reply With Quote
  #2  
By MotMann on 01-30-2008, 11:37 PM
Default

And what i must do, that the banner after the third Post displayed again?
Reply With Quote
  #3  
By Hoffi on 02-10-2008, 09:13 AM
Default

You did not use $counter if you use this if-Condition insted of the two from thegeek.:
HTML Code:
<if condition="THIS_SCRIPT == 'showthread' AND !$GLOBALS['FIRSTPOSTID']">
Reply With Quote
  #4  
By powerful_rogue on 09-17-2008, 12:39 PM
Default

Ive got this working so it shows after the 1st post. What would I need to add to get ti to show again after the last post?
Reply With Quote
  #5  
By Morgan on 09-17-2008, 03:23 PM
Default

Untested but instead of FIRSTPOSTID try using LASTPOSTID in its place.
Reply With Quote
  #6  
By powerful_rogue on 09-17-2008, 03:31 PM
Default

Is that as well as or instead of - <if condition="$counter == 1"><if condition="THIS_SCRIPT!='private'"><div style="padding-top:5px">$GAB_ads[x]</div></if></if>
Reply With Quote
  #7  
By Morgan on 09-17-2008, 03:46 PM
Default

On second thought, LASTPOSTID isn't known until after all the postbits have been processed, so the best you can probably do is to add $GAB_ads[X] to the vB ad_showthread_beforeqr template.
Reply With Quote
  #8  
By ichatfilipina on 03-10-2009, 09:42 AM
Default

$GAB_ads[X] - dont use capital X.. should use small letter x like this [x]. Remember: case-sensitive.
Reply With Quote
Comment

Tutorial Tools
Display Modes

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 11:34 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.

Tutorial powered by GARS 2.1.9 ©2005-2006