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

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
#1
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
 

Mike Fara

Active member
#3
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>
 
#5
Would somebody mind explaining what the following data represents?:

{xen:helper ismemberof, $visitor, 312}

helper? is member of (what)? visitor (guest?) 312?