MyBB Community Forums

Full Version: How to Add Ads before/within first post(unable to find)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to show ads before the first post. Only in threads and nowhere else.
I've also gone through many threads about adding ads within Mybb(like http://community.mybb.com/thread-110934.html ).

I've also installed Advertisement plugin. I could use only postbit ad feature. I don't want to use adding ads in the header which shows even in case of 404 error pages.

So is there any way I can add code within templates so that I can show ads within the first post or just before it?

I've also installed postlite( http://mods.mybb.com/view/postad-lite ) plugin which works for my one forum but not for another both 1.6.3 versions though.

I've PHPBB forums too and I could easily add using some macros like this:

<!-- IF postrow.S_FIRST_ROW -->

Is there anything similar to this in Mybb.
Install this plugin: http://community.mybb.com/thread-31860.html

And then add the following code BEFORE ALL code (if you want to show "before" first post) of your theme's postbit and postbit_classic templates OR paste that code after {$post['message']} code (if you want to show "within" first post);
<if ($postcounter - 1) % $mybb->settings['postsperpage'] == "0">
// Show ad code here.
</if>
Thanks Yaldaram but is there any other alternative without installing this mod?
Looks like bit complicated and risky stuff for what I want to do( inserting an ad).
Hi,

The alternative would be to code it all yourself.

The Mod/Plugin is a quick way to do it. Unless you want to spend hours coding it or paying for something to do it.

Smile
(2012-08-28, 09:33 AM)rag_gupta Wrote: [ -> ]Thanks Yaldaram but is there any other alternative without installing this mod?
Looks like bit complicated and risky stuff for what I want to do( inserting an ad).

Unfortunately you can't insert PHP code in your HTML templates. You've to install the above plugin and then you'll be able to add PHP directly in templates. I usually recommend to install this and then you can add many other useful things without installing dozens of plugins. Smile
Yaldaram, if you're recommending then I'd go for it. Smile
Cheers

Yaldaram http://mods.mybb.com/view/postad-lite is working nicely and it is able to insert ad within first post in my 1.6.3 forum. But it's not working in v1.6.7.
Can you please look into it's code and tell me why it is not running for 1.6.7?

Thanks

Yaldaram thanks, I could fix the issue within postad-lite as I've put in here: http://community.mybb.com/thread-70018-p...#pid904987 . It is sufficient for me.