View Full Version : Conditional for minimum posts per page
Diablotic
03-30-2011, 07:16 PM
I am looking for a condtional that will show an ad only if there is "x" posts on the page.
At the moment I am using:
<vb:if condition="$GLOBALS[threadinfo][replycount] >= x">AD</vb:if>
to display this ad only if there is minimum "x" posts posted in the thread but I would like to extend it to display it on only if there are "x" posts displayed on the page.
Anyone?
TheLastSuperman
03-30-2011, 07:29 PM
I am looking for a condtional that will show an ad only if there is "x" posts on the page.
At the moment I am using:
<vb:if condition="$GLOBALS[threadinfo][replycount] >= x">AD</vb:if>
to display this ad only if there is minimum "x" posts posted in the thread but I would like to extend it to display it on only if there are "x" posts displayed on the page.
Anyone?
I've answered this before... see if this info helps :cool:.
[QUOTE=karlm;2089165]Good stuffs, Clark. Can it be set so as you can choose which post # the ads go to? i.e. atm, they're forced after post #1... but What if I wanted it to be on post #9 instead?
Hmm you should be able to, open the template postbit_legacy_ads_after_firstpost and find:
<vb:if condition="!$GLOBALS['FIRSTPOSTID']">
Replace with:
<vb:if condition="$post['postcount'] % $vboptions['maxposts'] == ?">
Replace the ? mark with the post number you want the Ads to show after and DO NOT include a trailing </vb:if> as it's already near the bottom ;).
Let me know if that works :D.
Oooooor, I might want it so it's always the 'last but one' post..?
Well that depends on your post per page settings:
AdminCP > settings > Options > Thread Display Options (showthread) > Maximum Displayed Posts Before Page Split
So if you have that set to 20 posts per page before the split simply use the code I just posted above and change the ? mark to 19 ;).
Example:
<vb:if condition="$post['postcount'] % $vboptions['maxposts'] == 19">
So naturally ignore my references of opening that modifications template and simply note the code being used ;).
Diablotic
03-30-2011, 07:41 PM
This is good idea but there is another problem with this conditional, because I want to place this ad after first post it would need to be set like that:
<vb:if condition="$post['postcount'] % $vboptions['maxposts'] == 1">
And with this condition it will always show after first page but I want it to show after first post only if there are 2 or more replies on a page.
--------------- Added 1301593255 at 1301593255 ---------------
Anyone please?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.