vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Counting the number of posts displayed on a page? (https://vborg.vbsupport.ru/showthread.php?t=163617)

LanciaStratos 11-26-2007 03:16 AM

Counting the number of posts displayed on a page?
 
OK, I've got a right column down the side of my forum pages, the code of which is contained in my footer template. When viewing a thread, I'd like to have access to a variable that contains the number of posts being displayed on that particular page. I know that $post[postcount] obviously exists within the scope of postbit, but that's not exactly what I want nor is it usable from within the footer template. Is there another way to accomplish this that I haven't yet thought of? Any simple way to modify the source code?

(Why do I want to do this? Basically, I want to show more advertisements in the right hand column as the number of posts on the page increase. These obviously extend the page downward and I would love to take advantage of that otherwise wasted real estate.)

Analogpoint 11-26-2007 01:41 PM

Put this code in a plugin on the postbit_display_complete hook
Code:

$GLOBALS['pagepostcount'] = $post['postcount'];
Then in templates, use $GLOBALS['pagepostcount'] to reference it. But I may as well warn you that you won't be able to use it in the footer template, since the footer template is evaluated before the posts are displayed.

LanciaStratos 11-28-2007 02:51 AM

Ah, OK, sucks about the evaluation order of the footer template. Thanks anyway, AP!


All times are GMT. The time now is 01:55 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.01019 seconds
  • Memory Usage 1,709KB
  • 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
  • (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