How to add an ads block after first post on every page?

Avensen

Member
Hello. It's easy to add an ad block using

Code:
<xen:if is="{$post.position} == 0">
...
</xen:if>

condition in message template. However, ad block will only be shown on the first page of thread.

Is there a condition to show an ad block after first post on every page of a thread?

Thanks!
 
@Brogan when using this code it breaks on editing the first post on each page (the post disappears after editing it and it just keeps trying to load). The edit does take though but you have to reload the page. It is confusing members. :/

Code:
<xen:hook name="ad_message_below" />

<xen:if is="!{xen:helper ismemberof, $visitor, 11}">
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id} AND {$thread.reply_count} > 0">
</li><li>
<div style="padding-bottom: 10px;">
{ad code}
</div>
</xen:if>
</xen:if>
 
I can't reproduce that.

I have just tested it on my local with no issues at all.

Edit: Oh wait, it looks like you are using old code. Try enclosing it in a standard <li></li>. That code was required originally but the template has changed since then.
 
Try this:
Code:
<xen:hook name="ad_message_below" />

<xen:if is="!{xen:helper ismemberof, $visitor, 11}">
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id} AND {$thread.reply_count} > 0">
        <li>
            <div style="padding-bottom: 10px;">
                {ad code}
            </div>
        </li>
    </xen:if>
</xen:if>
 
Use this condition:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0">
...
</xen:if>
Hi Jake,

This works ok but in Conversation, ad displays after each message.
Anyway to add a condition to display on ad in thread or only after first message in conversation ?

Thanks !
 
Hi Jake,

This works ok but in Conversation, ad displays after each message.
Anyway to add a condition to display on ad in thread or only after first message in conversation ?

Thanks !

You can't use $post.position in conversations, it only works in threads. You could probably edit some more templates to add i="$i" to the loop to get it to work for you.
 
Any way to have the ad in the 1st, 3rd and 5th post of every page?
This is what I need before I can switch a few vBulletin installations over to XenForo. Does anyone know the conditional to make this work? I'm looking for 5th, 10th and 15th.

Also, not below the post table, but inside the post area at the bottom where the signature would go.

I'm using Siropu's Ad Manager for XenForo 2 but this particular feature is not working until the next release...
 
This is what I need before I can switch a few vBulletin installations over to XenForo. Does anyone know the conditional to make this work? I'm looking for 5th, 10th and 15th.

Also, not below the post table, but inside the post area at the bottom where the signature would go.

I'm using Siropu's Ad Manager for XenForo 2 but this particular feature is not working until the next release...

Absolutely not sure but i would try : (for below the post)

<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} = '5' AND {$post.position} % {$xenOptions.messagesPerPage} = '10' AND {$post.position} % {$xenOptions.messagesPerPage} = '15' AND !{$message.conversation_id}">

Don't know how to manage in signature.
 
Absolutely not sure but i would try : (for below the post)

<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} = '5' AND {$post.position} % {$xenOptions.messagesPerPage} = '10' AND {$post.position} % {$xenOptions.messagesPerPage} = '15' AND !{$message.conversation_id}">

Don't know how to manage in signature.
Thank you. For threads, there's "below content" and "below container". What you gave me is "below container". Any idea what the coding would be for that? Thanks again...
 
Top Bottom