vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   detecting number of posts in a thread (https://vborg.vbsupport.ru/showthread.php?t=275115)

dethfire 12-06-2011 02:19 PM

detecting number of posts in a thread
 
Is there an easy way to detect the number of posts in a thread? I want the reply button to be a quote button if there are no posts in the thread. Thus making sure people quote the original thread post for the first reply. Is there a variable already assigned in vB with this info? Maybe for show thread template? what do you think?

kh99 12-06-2011 05:46 PM

I think this should work:

Code:

<if condition="$GLOBALS['counter'] == 1 && $GLOBALS['limitlower'] == 0">
only one post
<else />
more than one post
</if>


ETA: added the check for $limitlower because I realized $counter is per page, so any page with one post would have triggered the "only one post" code.

dethfire 12-07-2011 04:05 PM

thanks kh99! I will go and try this!

--------------- Added [DATE]1323278426[/DATE] at [TIME]1323278426[/TIME] ---------------

sadly it doesn't work. added to my show thread template

kh99 12-07-2011 04:37 PM

I guess it needs a space between the <else and the />, which I added above. I tried it in my SHOWTHREAD and it seems to work. What happens for you?

dethfire 12-08-2011 02:03 AM

yes it works, thanks so much!


All times are GMT. The time now is 03:40 AM.

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.01045 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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