PDA

View Full Version : Template Conditional for Ad slot after 5th Post in Postbit


induslady
09-09-2014, 08:04 AM
Hello,

Am looking to display ads in showthread page in the below positions -

1)After First Post
2)After 5th Post ONLY IF the thread has 10 posts.

For #1, Have used the template conditional in postbit-
<vb:if condition="THIS_SCRIPT == showthread AND !$GLOBALS['FIRSTPOSTID']">

Similarly for #2, can anyone help me with the template conditional.

Thanks.

ozzy47
09-09-2014, 09:00 AM
<vb:if condition="$post['postcount'] % $vboptions['maxposts'] == ?">

Replace the ? mark with the post number you want the Ads to show after.

induslady
09-10-2014, 07:11 AM
Yes Thanks, that worked good.

--------------- Added 1410341902 at 1410341902 ---------------

Hello ozzy47,
Looks like the conditional

<vb:if condition="$post['postcount'] % $vboptions['maxposts'] == 5">

is displaying the ad after 5th post, that is fine.

But what am looking for is the below -

- Display ad after 5th post ONLY if the thread page has 10 posts.
- Do not display Ad if the thread page has 5 or 6 or 7 or 8 or 9 posts in it.

Let me know how this conditional could be tweaked.

For info, I have the below setting in my forum -
Maximum Displayed Posts Before Page Split - 10

mokujin
09-10-2014, 08:44 AM
Try this: :D
<vb:if condition="($post['postcount'] % $vboptions['maxposts'] == 5) AND $post['postcount'] > 9">

induslady
09-10-2014, 11:13 AM
Hello mokujin,

The above conditional is not working.

punchbowl
09-10-2014, 08:06 PM
Hello mokujin,

The above conditional is not working.
try this:
Try this: :D
<vb:if condition="$post['postcount'] % $vboptions['maxposts'] == 5) AND $post['postcount'] > 9">

(removed stray '(' )

is maxposts about the page or about the thread btw? i.e. say I have 10 posts per page and 11 posts in total is postcount 1 or 11?, what is the conditional for basically saying "if there is only x posts on this page"?

ozzy47
09-10-2014, 09:07 PM
Hello mokujin,

The above conditional is not working.

Try this one.

<vb:if condition="post['postcount'] % $vboptions['maxposts'] == 5 AND $GLOBALS[threadinfo][replycount] >= 9">

ozzy47
09-10-2014, 09:10 PM
try this:


(removed stray '(' )

is maxposts about the page or about the thread btw? i.e. say I have 10 posts per page and 11 posts in total is postcount 1 or 11?, what is the conditional for basically saying "if there is only x posts on this page"?

For the "if there is only x posts on this page"

<vb:if condition="$post[postcount] == X>

punchbowl
09-10-2014, 09:30 PM
For the "if there is only x posts on this page"

<vb:if condition="$post[postcount] == X>

brilliant thanks...exactly what I wanted.

ozzy47
09-10-2014, 09:31 PM
Not a problem, glad to help. :)

punchbowl
09-11-2014, 09:12 AM
For some reason this works fine on in ad_showthread_firstpost but doesn't seem to work on ad_showthread_beforeqr or if you do something like

<if condition="THIS_SCRIPT == 'showthread' and $post[postcount] == 1>hello</if>
in the footer

It only seems to work as vb is producing the posts not in templates calls after. In 3.8 anyway. Sorry yes I'm using 3.8 but the conditionals are almost exactly the same so I didn't think anyone would mind:erm:

ozzy47
09-11-2014, 09:48 AM
Possibly this.

<vb:if condition="THIS_SCRIPT == 'showthread' and $GLOBALS[postcount] == 1>hello</vb:if>

punchbowl
09-11-2014, 11:05 AM
Nope. Doesn't seem to know the postcount outside of the postbit template itself. Not a big deal anyway. Thanks for your help.

induslady
09-16-2014, 11:09 AM
To display Ad after the 5th post ONLY if the thread has 10 posts, I used the below conditional -

<vb:if condition="($post['postcount'] % $vboptions['maxposts'] == 5) AND ($post['postcount'] > 9)">

but this is not working. what is happening is that the ad is not getting displayed after 5th post even when there are 10 posts in the thread.
Please help me with the workable conditional.
Thanks.

induslady
09-23-2014, 04:40 AM
Hello All,

Hope this might be useful to some one,

To display Ad after the 5th post ONLY if the thread has minimum 6 posts the below conditional works -

<vb:if condition="($post['postcount'] % $vboptions['maxposts'] == 5) AND ($GLOBALS[threadinfo][replycount] % $vboptions['maxposts'] <> 4)">

ukdalai
11-06-2014, 08:04 PM
hi all, this is useful, not sure if it what im looking for but it might be, i need to put an ad underneath the first post just for 2 usergroups and only in one forum.

could this do that for me, if so, in what template and where within the template where would i need to put the conditionals.

i was thinking something like this:


<vb:if condition="$post['postcount'] % $vboptions['maxposts'] == 1">
<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">
<vb:if condition="$GLOBALS['forumid'] == X">
SHOW AD
</vb:if>
</vb:if>
</vb:if>


Would this work, and where do i put the code.

Craig

adpar
07-19-2015, 09:13 AM
thank you it works very well

can i ask you what number should i place inside that code

if i want to display

additional banners like this

after post 12 if thread has at least 18 posts
after post 24 if thread has at least 30 posts
or something like that.

i.e. i will be placing many banners on 1 page,
since we have max post number at 40
so there is a lot of space scrolling down.

we put many ngo ads and need the extra space, and since they are not paid ads but ngo messages,
we dont mind showing them to our readers .

thank you in advance to whoever will help !!