vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Template Conditional for Ad slot after 5th Post in Postbit (https://vborg.vbsupport.ru/showthread.php?t=314199)

induslady 09-09-2014 08:04 AM

Template Conditional for Ad slot after 5th Post in Postbit
 
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

HTML Code:

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

Hello ozzy47,
Looks like the conditional

Code:

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

<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

Quote:

Originally Posted by induslady (Post 2514527)
Hello mokujin,

The above conditional is not working.

try this:
Quote:

Originally Posted by mokujin (Post 2514502)
Try this: :D
HTML Code:

<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

Quote:

Originally Posted by induslady (Post 2514527)
Hello mokujin,

The above conditional is not working.

Try this one.

HTML Code:

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

ozzy47 09-10-2014 09:10 PM

Quote:

Originally Posted by punchbowl (Post 2514599)
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"

HTML Code:

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

punchbowl 09-10-2014 09:30 PM

Quote:

Originally Posted by ozzy47 (Post 2514604)
For the "if there is only x posts on this page"

HTML Code:

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


All times are GMT. The time now is 09:25 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.02343 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_code_printable
  • (6)bbcode_html_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete