Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 conditional statement for adsense
mac834 Offline
Junior Member
**
Posts: 3
Joined: May 2011
Post: #1
conditional statement for adsense
I am trying to get adsense to appear after the last post on a page, but only if the page has 3 or more posts.

Here is what I have so far at the bottom of the postbit template:

Code:
<if ($postcounter - 1) % ($mybb->settings['postsperpage']) == "2" then>
adsense code here
</if>


This shows an ad after the 3nd post only, but I can not figure how to make it show it AFTER the last post, IF there are 3 or more posts.

Example: If a page had 8 posts, it would show the ad after the 8th post, if it had 4 posts, it would show it after the 4rd, if it had 10 posts, it would show it after the 10th post.  Note that that is the number of posts per page and not per thread.

05-21-2011 11:30 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
conditional statement for adsense - mac834 - 05-21-2011 11:30 AM

 Standard Tools
Forum Jump: