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

Place Banner in every last post?!

DerTobi75

Active member
#1
Hi,

I would like to place a bannerad in every last post on every page, not thread, is there a template conditional for this?

Regards,

Tobi
 

Brogan

XenForo moderator
Staff member
#2
Add this to the ad_message_body template:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 19">
Advert code
</xen:if>
Change the 19 to whatever number of posts you have per page, minus 1; so if you have 20, set it to 19.
 

DerTobi75

Active member
#3
Add this to the ad_message_body template:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 19">
Advert code
</xen:if>
Change the 19 to whatever number of posts you have per page, minus 1; so if you have 20, set it to 19.
I just tried that kind, it kinda works, but what if the thread just have 2 postings?!
 

Enigma

Well-known member
#4
Code:
<xen:if is="{$post.post_id} == {$lastPost.post_id}">
There's also $post.position_on_page which would simplify the above condition:

Code:
<xen:if is="{$post.position_on_page} == {$xenOptions.messagesPerPage}">
But that only works for pages that have the maximum number of posts on them.
 

Lawrence

Well-known member
#5
This bit of code will display an ad on the last post of each page: If the last (or only) page contains less posts than the messages per page setting, the last post will still display the ad.

Code:
<xen:if is="{$post.position} + 1 == {$xenOptions.messagesPerPage} * {$page}">
    your ad code
<xen:else />
    <xen:if is="{$post.position} == {$totalPosts} - 1">
        your ad code
    </xen:if>
</xen:if>
 

DerTobi75

Active member
#6
This bit of code will display an ad on the last post of each page: If the last (or only) page contains less posts than the messages per page setting, the last post will still display the ad.

Code:
<xen:if is="{$post.position} + 1 == {$xenOptions.messagesPerPage} * {$page}">
    your ad code
<xen:else />
    <xen:if is="{$post.position} == {$totalPosts} - 1">
        your ad code
    </xen:if>
</xen:if>
Yes, this is working like a charm! Many thanks, ...