Place Banner in every last post?!

DerTobi75

Active member
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
 
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.
 
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?!
 
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.
 
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>
 
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, ...
 
Top Bottom