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?
 
#7
Is the person viewing the page (the visitor) a member of the user group with ID 312.
I see. So in this command:
<xen:if is="!{xen:helper ismemberof, $visitor, 312}">

So the ad code associated with that command will not display for anyone in user group 312. Correct?
 
Top