Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 05 Oct 2011, 15:24
benFF benFF is offline
 
Join Date: Jul 2004
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:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Works fine as long as there is only one page of posts, however, if on page 2, 3, 4 etc - then the value is always true, so it doesn't work as I need.

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!
Reply With Quote
  #2  
Old 05 Oct 2011, 19:40
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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.
Reply With Quote
  #3  
Old 06 Oct 2011, 05:00
benFF benFF is offline
 
Join Date: Jul 2004
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?
Reply With Quote
  #4  
Old 06 Oct 2011, 07:27
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by benFF View Post
Although - if the $counter variable is always there, then it could be used in a conditional in the template itself?
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).
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 03:08.

Layout Options | Width: Wide Color: