2014-04-09, 05:04 PM
Pages: 1 2
2014-04-09, 06:52 PM
Try changing the 5 to a 10
http://community.mybb.com/thread-152625-...pid1069286
http://community.mybb.com/thread-152625-...pid1069286
2014-04-09, 07:00 PM
Thanks man but I want the conditional to first check if the page contains 10 posts and if it does then next check if the 10th post is not last only then show code but hey thanks for trying to help
2014-04-10, 12:15 PM
<if $postcounter == 10 && $thread['lastpost'] != $post['dateline'] then>
10th post not last...
</if>
DrXotick seems to be right - if the post counter is not ten it won't show, if it is the last post it wont show. Have you tried that code?
2014-04-10, 12:56 PM
@Leefish baby thanks very much for your reply. Please let me explain Google only allows 3 ads per page and I want the add to show in 1st, 2nd and 3th post so it makes 3 posts per page that has 10 posts. Now the problem is I have a code that adds Adsense to last post so it will result in 4 ads per page!
I am looking for a way to show ad in the 3th post only if the page has 10 posts and the last post is not last only then show ad in 3th post! Crazy I know?
I don't know maybe I can do this:
I am looking for a way to show ad in the 3th post only if the page has 10 posts and the last post is not last only then show ad in 3th post! Crazy I know?
I don't know maybe I can do this:
<if $postcounter == 10 && $thread['lastpost'] != $post['dateline'] then>
<if $postcounter == 3 && $thread['lastpost'] != $post['dateline'] then>
3rd post not last...
</if>
</if>
2014-04-10, 01:03 PM
First, dont call me baby , lee is fine.
So what you want is a way to count how many posts there are on the page? No idea.
So what you want is a way to count how many posts there are on the page? No idea.
2014-04-10, 01:26 PM
Sorry lee! I was juts trying to be friendly with you but it's cool.
Could you please make this work?
Could you please make this work?
<if (($postcounter - 3) % $mybb->settings['postsperpage'] == 0) && (($postcounter - 10) % $mybb->settings['postsperpage'] == 0) then>
3rd post adsense
</if>
2014-04-10, 04:17 PM
Both codes you posted have no sense - they always result in false and the text would never be output.
You can try:
You can try:
<if ($postcounter - 3) % $mybb->settings['postsperpage'] == 0 && $thread['replies'] - $page * $mybb->settings['postsperpage'] < $mybb->settings['postsperpage'] then>
Output ad in 3rd post on each page only if post limit on one page wasn't reached (by default 10).
</if>
Didn't test but should work.2014-04-10, 07:49 PM
D666 my man thanks very much for your support I have just tested it and I am very sorry but it's not working! It shows after the 1 page and despite the fact that page only has 6 posts. Please if you think it could be done help me?
2014-04-11, 10:40 AM
I don't even understand what you want then... Can you elaborate or show it on a screen?
This is how it works:
1st conditional before && checks if the post is 3rd on any page
2nd checks the amount of replies on page, it is true only if there are less posts than $mybb->settings['postsperpage'] on that page.
For example for $mybb->settings['postsperpage'] = 10 and $thread['replies'] = 17 (number of replies in thread):
Page 1: 1,2,3,4,5,6,7,8,9,10 Page 2: 11,12,13,14,15,16,17 - only 13 will be true and ad will show there (tested and works). So it won't show in 3rd post as you said when you have ad in last (10th) post on that page...
This is how it works:
1st conditional before && checks if the post is 3rd on any page
2nd checks the amount of replies on page, it is true only if there are less posts than $mybb->settings['postsperpage'] on that page.
For example for $mybb->settings['postsperpage'] = 10 and $thread['replies'] = 17 (number of replies in thread):
Page 1: 1,2,3,4,5,6,7,8,9,10 Page 2: 11,12,13,14,15,16,17 - only 13 will be true and ad will show there (tested and works). So it won't show in 3rd post as you said when you have ad in last (10th) post on that page...
Pages: 1 2