vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Conditional for minimum posts per page (https://vborg.vbsupport.ru/showthread.php?t=261190)

Diablotic 03-30-2011 07:16 PM

Conditional for minimum posts per page
 
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:
Code:

<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

Quote:

Originally Posted by Diablotic (Post 2179165)
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:
Code:

<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=TheLastSuperman]
Quote:

Originally Posted by karlm (Post 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?

Quote:

Originally Posted by TheLastSuperman (Post 2089168)
Hmm you should be able to, open the template postbit_legacy_ads_after_firstpost and find:

Code:

<vb:if condition="!$GLOBALS['FIRSTPOSTID']">
Replace with:

Code:

<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.

Quote:

Originally Posted by karlm (Post 2089166)
Oooooor, I might want it so it's always the 'last but one' post..?

Quote:

Originally Posted by TheLastSuperman (Post 2089170)
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:

Code:

<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:

Code:

<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 [DATE]1301593255[/DATE] at [TIME]1301593255[/TIME] ---------------

Anyone please?


All times are GMT. The time now is 11:37 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01026 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete