PDA

View Full Version : Putting ad spot beween say 20th and 21st posts in thread?


ForrestBlack
09-24-2009, 11:31 PM
I searched around and didn't find a current way to do this to the templates (partly because 'ad' is only two letters), so forgive me if I missed it, but what I am looking for is a way to insert an ad banner spot between say the 20th and 21st posts in a thread, for all threads. Something like if thread has 25+ posts showing on this page, put an ad spot between number 20 and 21, or whatever.

Can anyone point me in the right direction? I looked at some of the ad management plugins/mods and the current ones don't seem to have ads between specified posts as an option.

sparklywater
09-25-2009, 07:43 AM
I would like to know this too.

Lynne
09-25-2009, 02:22 PM
I think the variable you would look at is $post['postcount']. So at the top of your postbit (or postbit_legacy) template, you would put something like:

<if condition="$post['postcount'] == 21">
an ad
<if>

sparklywater
09-25-2009, 03:03 PM
I think the variable you would look at is $post['postcount']. So at the top of your postbit (or postbit_legacy) template, you would put something like:

<if condition="$post['postcount'] == 21">
an ad
<if>

Is there a way to count posts as a multiple of a number? Such as multiples of 10, ie. 10, 20, 30, 40... So the conditional would only apply if the post count is a multiple of 10...?

Lynne
09-25-2009, 03:27 PM
What you do is something like ...

<if condition="$post['postcount'] % 10 == 0">
do something
</if>That may not be exact... look up php operators. You want to see what the remainder is after dividing by 10 - I think it's called the modulus or something like that. So, if 10/10 has a remainder of 0, then you do something.