MyBB Community Forums

Full Version: Banner/Ads after second post in thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi I want to know which template and where in the template do i paste the code  (<div class="blah"very_long_code</div>)
for banners/ads to make them apear after the second or third post in a thread


Please answers should be like this
paste in in classic template under/above {$blahblah}


 thank you in advance
install & activate template conditionals plugin
you can add below code at the bottom of postbit_classic template
<if ($postcounter - 2) % $mybb->settings['postsperpage'] == "0" then>
<div class="mypbadcode">your advertisement / banner code</div>
</if>
Sorry to interrupt, .m.
But I fear this will not work. The variable $postcounter is only used for threaded display in showthread.php. In linear display there is no counter.

Perhaps a plugin might work, but that would need some study (for me at least Wink ).
^ can you test it by adding <h4>{$postcounter}</h4> in the postbit templates please ..
You are right Blush , it is also a counter in linear display. I could not find that in showthread.php, so the counter must be kept in function build_postbit().

But should it then not be:

($postcounter-1)%$mybb->settings['postsperpage'] > 1 (or 2 for the 3rd post on page)?
^ that statement becomes true for many values of $postcounter .. so banner will be displayed multiple times!
(2015-06-18, 05:08 PM).m. Wrote: [ -> ]^ that statement becomes true for many values of $postcounter .. so banner will be displayed multiple times!

OK, I was thinking in integers, because the modulus operation returns an integer value.

Too much FORTRAN  history I think, where mixed mode operations were (in the early days of programming) always tricky Wink .

EDIT
But I still do not understand it:

for post 1:  (1-2)%$postsoerpage = -1 -> -1 == "0" -> false
for post 2:  (2-2)%$postsoerpage = 0  ->  0 == "0" -> true
for post 3:  (3-2)%$postsoerpage = 1  ->  1 == "0" -> false

etc

Sorry, I can't help it Big Grin
Wow.... I am even more confused, adding these codes below the post bit template makes them apear on every single post, can I just make it apear after the first post on the thread
^ have you installed & activated template conditionals plugin ? it is required.