The vB Geek

The vB Geek (http://www.thevbgeek.com/index.php)
-   Tutorials (http://www.thevbgeek.com/forumdisplay.php?f=12)
-   -   Ad after every X posts (http://www.thevbgeek.com/showthread.php?t=3914)

Morgan 02-05-2008 03:21 AM

Ad after every X posts
 
Add a plugin to the postbit_display_complete hook with the following code:
Code:

global $GAB_ads;
Add the following to the end of the postbit template, changing X to the number of posts before an
ad appears and changing Y to 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 depending on what you have set in GAB:
Code:

<if condition="$post[postcount] % X == 0">
        <div style="padding-top:5px">
                $GAB_ads[Y]
        </div>
</if>

If you want the ad to be random, not the same ad every single time, do the following instead.

Add a plugin to the postbit_display_complete hook with the following code:
Code:

global $GAB_ads;
$GAB_random_key = 0;
if (is_array($GAB_ads))
{
        $GAB_random_key = array_rand($GAB_ads);
}

Add the following to the end of the postbit template, changing X to the number of posts before an
ad appears:
Code:

<if condition="$post[postcount] % X == 0">
        <div style="padding-top:5px">
                $GAB_ads[$GAB_random_key]
        </div>
</if>

Note that the latter method assumes you have set at least two $GAB_ads[X] variables in scripts.

dsurban 02-09-2008 08:27 AM

where do I fhind this?

"Add a plugin to the postbit_display_complete hook with the following code:"

thanks

Morgan 02-09-2008 08:29 AM

See http://www.vbulletin.com/docs/html/main/add_plugin for how to add a plugin.

dsurban 02-09-2008 02:43 PM

cheers, got it working now

KenDude 02-10-2008 05:11 AM

Quote:

Originally Posted by Morgan (Post 23067)


This link is not working for me... :(

Morgan 02-11-2008 04:34 PM

Try http://www.vbulletin.com/docs/html/m...rsion=30506500 instead.

mushrom 03-12-2008 03:01 PM

with this tutorial can we make that ads appear ONLY after the 1st post and not every X posts?

Morgan 03-12-2008 04:58 PM

http://www.thevbgeek.com/showthread.php?t=2952

ichatfilipina 03-10-2009 09:45 AM

<if condition="$post[postcount] % X == 0">
<div style="padding-top:5px">
$GAB_ads[$GAB_random_key]
</div>
</if>

--
<if condition="$post[postcount] % X == 0"> is this really capital X? or small case?

Morgan 03-11-2009 10:12 PM

The account you used to post your message is showing as unlicensed. Please use the account with a license to obtain support. Thank you.


All times are GMT. The time now is 09:54 PM.

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

Tutorial powered by GARS 2.1.9 ©2005-2006