MyBB Community Forums

Full Version: adsense after last post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to place adsense code immediately AFTER the last post pn a page. I would like it to appear ONLY if there are X number or more posts on that page. For example if I changed X to 5 then only if there are 5 or more posts on that page would the adsense code appear after the last post.

The plugins I found here did not appear to support this feature.

I don't necessarily need a plugin, I don't mind editing the templates but I am not sure how to make the ad appear ONLY if there are X or more posts.

Any ideas?

If you cannot find any free solution, there is a paid solution here :
http://www.mybbcodes.com/showthread.php?tid=391

You need to subscribe for a year(10$) and are able to download whatever you need for that period from over 175 plugins...
Thank yoiu for your reply. But reading through the thread you linked I do not see where it states that you are able to show ads after the last post ONLY when there is a minimum number of posts on the page. I do not mind paying for something but don't want to pay for something that don't do what I want it to do.

I see where the plugin will show ads between posts, which I am already able to do. I just need to show ads AFTER the last post when there are X number of threads or more.
You can add your adsense ads code directly into the showthread template above {$quickreply}. There's no need for any plugin in this case. The ad will be visible at the end of all posts.
(2011-05-18, 03:34 PM)Yaldaram Wrote: [ -> ]You can add your adsense ads code directly into the showthread template above {$quickreply}. There's no need for any plugin in this case. The ad will be visible at the end of all posts.

Yes, that's what I do now and it works.

However I would like to ONLY show the ads IF there are a certain number of posts on the page.

In Vbulletin I would add an if condition such as below if I wanted to add the add if there were 3 or more posts:
 
<if condition="$post['postcount'] > 3">
ad code here
</if>

But I don't know how to do it in Mybb as the above code doesn't work.
So basically you are looking for an ad to show after 3 or more posts ?

Install this plugin: http://community.mybb.com/thread-31860.html

Then add the following code just After the </table> in postbit template;
<if ({$postcounter} - 1) % {$mybb->settings['postsperpage']} == "2" then>
ADS_CODE
</if>

Didn't tested but I guess it should work.
Okay will test it later today and get back with you, thanks!!
example..
<if ... then> ads code </if>
(2011-05-18, 03:31 PM)tr549 Wrote: [ -> ]Thank yoiu for your reply. But reading through the thread you linked I do not see where it states that you are able to show ads after the last post ONLY when there is a minimum number of posts on the page. I do not mind paying for something but don't want to pay for something that don't do what I want it to do.

I see where the plugin will show ads between posts, which I am already able to do. I just need to show ads AFTER the last post when there are X number of threads or more.


I could add, to this plugin, the option of displaying only after the last post if the number of posts is greater than a certain amount.

I would suggest that you try the two other free solutions proposed to you, using Yumi conditionals plugin for the FBI solution, then if you prefer my solution just contact me on MyBBCodes. Wink
(2011-05-18, 03:48 PM)Yaldaram Wrote: [ -> ]So basically you are looking for an ad to show after 3 or more posts ?

Install this plugin: http://community.mybb.com/thread-31860.html

Then add the following code just After the </table> in postbit template;
<if ({$postcounter} - 1) % {$mybb->settings['postsperpage']} == "2" then>
ADS_CODE
</if>

Didn't tested but I guess it should work.

The above code puts the add after 3 posts on a page. I want it to put it after the LAST post on the page, but ONLY if there are 3 or more posts. In other words 2 posts, no add. 3 or more, there is an add but only after the very LAST post. So if there were 8 posts on a page the add would be after the 8th post.

Below is my exact code on how I do this in the postbit templet on my Vbulletin forum, if you know how to convert it to MYbb that would be great:

<if condition="$post['islastshown'] AND !$GLOBALS['vbulletin']->GPC['ajax']">
<if condition="$post['postcount'] > 2">
ad code here
</if></if>

I guess what I am asking is there a MYbb if condition statement equal to the post['islastshown'] like in the above vbulletin code.

Thanks for all your help.