The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Get current amount of posts shown on a page
I'm working on a conditional which runs in the "global_start" hook which sets up adverts for the page.
One of the things I am doing, push advert banner data into the ad_location_showthread_afterqr template, but ONLY if there are more than 2 replies shown on the page. The code: PHP Code:
As I don't have access to the $post parameter at that time, I can't do a count (can I?) so does anyone know the code I need? Psuedo like: If more than 2 replies shown on THIS page, then set X=Y Thanks! |
#2
|
|||
|
|||
Is ad_location_showthread_afterqr a template you added? Where is is being used? If it's in the SHOWTHREAD template then you can probably move your plugin to showthread_complete and use $counter as a count of the posts on the page.
|
#3
|
|||
|
|||
Lol, sorry I totally got that wrong - it's the ad_showthread_beforeqr template (the one built in).
I can't move the plugin though, as it's a single one which works out all the advert banners for the page (be it a show thread or not). Actually, that's not true - *ideally* I don't want to be chopping it all up - but if there is no other way, then so be it. Although - if the $counter variable is always there, then it could be used in a conditional in the template itself? |
#4
|
|||
|
|||
The problem is that when the global_start hook code is executed, $counter won't have been set yet. You might be able to look at the page and perpage variables and figure out how many replies will be on the current page (you should be able to figure that out from looking at code in showthread.php).
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|