Not Solved template conditionals, how to determine last post on the page?
#1
Not Solved
I'd like to put an ad inside the last post of a thread on a page.

I'm using this:
<if ($postcounter - 1) % $mybb->settings['postsperpage'] == "0" then>

To determine first post, but want to put an ad in the last post of each page.
Reply
#2
Not Solved
template conditional is not required for placing advt after the last post
in the showthread template, you can put required code at the bottom of code like below
<div id="posts">
	{$posts} 
</div>
Reply
#3
Not Solved
Thanks .m.,

I want to put it actually inside the post. Not outside. I'm using postbit now to place it in the first post, but need theconditional statement to place an ad in the last post if there's 4 or more posts on a page of a thread. eg, [if number of posts on page > 3 then advertisement in last post]
Reply
#4
Not Solved
<if ($postcounter - $mybb->settings['postsperpage']) % $mybb->settings['postsperpage'] == 0 || $thread['lastpost'] == $post['dateline'] then>
xxx
</if>
for last post on each page, no matter which post is that on last page.

<if ($postcounter - $mybb->settings['postsperpage']) % $mybb->settings['postsperpage'] == 0 || ($thread['lastpost'] == $post['dateline'] && ($postcounter - 3) % $mybb->settings['postsperpage'] > 0) then>
xxx
</if>
for last post on each page except last and last post on last page if it's higher than 3 on that page.
Reply
#5
Not Solved
<if $thread['replyto'] == 0 then>
	// do something if first post
</if>

<if $thread['lastpost'] == $post['dateline'] then>
	// do something if last post
</if>

<if $postcounter == $mybb->settings['postsperpage']*($page-1)+1 then>
	// do something if first post in the current page
</if>

<if $postcounter == $mybb->settings['postsperpage']*$page then>
	// do something if last post in the current page
</if>

<if $postcounter == n then>
	// do something if nth post
</if>
[Image: fSGNVQj.png]
Reply
#6
Not Solved
Okay. This is excellent. Thanks Destroy666 and thanks Shade for the extra info.

I ended up using

<if ($postcounter - $mybb->settings['postsperpage']) % $mybb->settings['postsperpage'] == 0 || ($thread['lastpost'] == $post['dateline'] && ($postcounter - 3) % $mybb->settings['postsperpage'] > 0) then>
xxx
</if>

Works butter.
Reply


Forum Jump:


Users browsing this thread: