![]() |
How to displaying advert after first post, 15th post and 29th post?
How do I identify the first, 15th and 29th post on the page please?
And then in the conditional in postbit_legacy, do I just eval the similar templates for each advert? |
im not 100% on this sombody correct me if im wrong, i know for a fact to get it to display after the first post you would go into postbit / postbit legacy and at the very bottom add
Code:
<if condition="$post[postcount] == 1"> Code:
<if condition="$post[postcount] == 1,15,29"> |
Quote:
Quote:
|
Thanks. Default for our forums is 30 posts per page.
In each of those locations I want to display an advert. I'm guessing the best option is to eval a template? But a different one each time? |
Quote:
|
why wouldn't my recomendation of if condition postcount work for this?
|
Quote:
Code:
<if condition="$post[postcount] == 1,15,29"> but maybe you were thinking of using in_array(), like: Code:
<if condition="in_array($post[postcount], array(1,15,29))"> even so, I think $post[postcount] is the count of the post within the entire thread, and I think the OP asked about the posts on each page (so I think the condition above wouldn't show anything after the first page). |
1 Attachment(s)
i will test this really quick and post the results
ok OP this is what you should use, it just requires a simple code into postbit legacy no plugins required, kh was right i had the condition wrong but the idea was correct i used <if condition="in_array($post[postcount], array(1,15,23))"> <center><h1>ad code</h1></center> </if> at the very bottom of postbit legacy, with threads set to display 10 per page, so each post 1 15 and 23 were on seperate pages, the adcode displayed correctly under each post i specified, no matter the page it was on this method works great and i will be using it myself now too. |
Well, I think spinball has 30 posts per page and wanted the ads to show up on each page. But now that I think about it, you could use ($post[postcount] % 30). And I think that is a better solution especially since it looks like the 'counter' variable isn't used if you're using threaded or hybrid mode to view the thread.
|
Thanks, all.
Nearly there. Is there a GLOBALS variable which stores the number of posts being displayed? I.e. visible posts? I ask because I only want the system to 'prepare' the banners for the actual number which will be displayed. |
I think 'perpage' should work. Edit: well, it will tell you the page size being used, but I don't think it will tell you if the current page is full. I don't see any way to do that offhand.
|
No perpage is 30 whatever number of replies there are.
Perhaps there isn't a value for the number of visible posts in a SHOWTHREAD page. |
There doesn't seem to be, but there is a global $posts that is the result of the post query, so you could do something like:
Code:
global $db, $posts; in a plugin, of course. There are other checks before posts are displayed so I guess there might be situations where there are more rows than posts, but I suppose if it works sometimes, that's better than not checking at all. |
This is out of one of my ad mods
PHP Code:
|
All times are GMT. The time now is 08:03 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|