XF 1.5 Conditional for ad above last post?

island

Active member
In vbulletin I have an ad shown above the last post on a page. So on a page with 7 posts, the ad will show above post 7 (below post 6) and on a page with 15 posts the ad will show above post 15 (below post 14.)

Is there a way to use xenforo conditionals to do this?
 
Ah -- easier than I thought adapting slightly from Brogan's excellent guide in the Resources section
(changing - 1 to - 2 and adding the -1 to change from below to above the last post on a page.)

<xen:hook name="ad_message_below" />
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == {$xenOptions.messagesPerPage} - 2 OR {$post.position} == {$thread.reply_count} - 1 AND !{$message.conversation_id}">
<li>
Ad code
</li>
</xen:if>
 
Top Bottom