• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Place ad after last post

Jafo

Active member
#1
If this has been solved before, then I apologize, but I searched and searched and did not find a great answer to this problem.

I needed to be able to show an ad after the last post on each page. All the solutions I found would not work if the page did not fill all the slots for a full page. This does:

Code:
<xen:if is="{$message.position} == {$xenOptions.messagesPerPage} - 1 OR {$message.position} == {$thread.reply_count}">
   <!--AD CODE HERE -->
</xen:if>
I just wanted to post this here so others and myself can find it again in the future when needed.
 

dethfire

Well-known member
#4
So is there a way to do with via conditionals? I am looking to place an ad in the last post of each page (granted it's not the first or second post)
 

popowich

Active member
#5
Is there a way with the conditionals to do a placement "if there are 3 or more posts, then place in the last post?"

edit: edit: nope, my edit was wrong. I still have this question, and settling for a third post placement in the meantime.
 
Last edited:

popowich

Active member
#6
I'm trying to piece some of the previous discussions together into a working answer.

What's the right way to write this?

<xen:if is="{$post.position} == {$thread.reply_count} AND {$xenOptions.messagesPerPage} > 2">

I'm looking for the last post on a page only if there are more than 2 posts on that page.
 

popowich

Active member
#7
$5 paypal to the working answer just to make my day more excellent.

Using Xenforo conditionals and not a paid add-on, I want to place an ad in the last post of every page only if there are 3 or more posts on the page being viewed.

If there are 7 posts it goes in post 7, if there are 3 posts it goes in post 3. If it's the first post on the second page, it should not display.
 

Brogan

XenForo moderator
Staff member
#8
HTML:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == {$xenOptions.messagesPerPage} - 1 OR {$post.position} == {$thread.reply_count} AND {$thread.reply_count} % {$xenOptions.messagesPerPage} > 1">
    Ad code here
</xen:if>