XF 1.2 Ad on first and last post of every page - but if 0 replies, 2 ads appear on same post!

Mike Fara

Active member
This code works great, however:

Code:
<xen:hook name="ad_message_body" />
<xen:if is="!{xen:helper ismemberof, $visitor, 312}">
<xen:if is="({$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id})">
<div style="float: right;">
AD_CODE
</div>
</xen:if>
<xen:if is="({$post.position} % {$xenOptions.messagesPerPage} == {$xenOptions.messagesPerPage} - 1 OR {$post.position} == {$thread.reply_count} AND !{$message.conversation_id})">
<div style="float: right;">
AD_CODE
</div>
</xen:if>
</xen:if>

When there are no replies, two block ads appear instead of one. Basically I am floating two ads on the first post and last post of each thread page. It is working, except when theres zero replies. In that case, TWO ads get placed in the same post.

Does anyone have a solution on how one would solve this one? TY
 
One answer was found here:
Code:
<xen:hook name="ad_message_body" />
<xen:if is="!{xen:helper ismemberof, $visitor, 312}">
<xen:if is="({$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id})">
<div style="float: right;">
AD_CODE
</div>
</xen:if>

<xen:if is="(!{$post.position} % {$xenOptions.messagesPerPage} == 0)">
<xen:if is="({$post.position} % {$xenOptions.messagesPerPage} == {$xenOptions.messagesPerPage} - 1 OR {$post.position} == {$thread.reply_count} AND !{$message.conversation_id})">
<div style="float: right;">
AD_CODE
</div>

</xen:if>
</xen:if>
</xen:if>
 
Back
Top Bottom