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

XF 1.3 After the 11th Post on every thread page

Discussion in 'XenForo Questions and Support' started by akia, Aug 24, 2014.

  1. akia

    akia Well-Known Member

    Can someone help me with what condition I'd use to show something after the 15th post on every page of a thread but only on threads, not conversations.

    Thanks in advance.
  2. Brogan

    Brogan XenForo Moderator Staff Member

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

    Not sure if you mean 11 or 15, as the thread title differs from the post content.
  3. akia

    akia Well-Known Member

    Thank you @Brogan, I know you'd come to the rescue!

    I was just checking to make sure you was paying attention ;)
  4. akia

    akia Well-Known Member

    Can this be used in the header template, or something equivalent,the problem with using dfp is that along with the ad slot on the page I need to put code in the header, which I don't want to be calling if the ad isn't going to be displayed.
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Why do you need to put it in the header if it's only going to display in the thread view?
  6. akia

    akia Well-Known Member

    Because the DoubleClick code comes in two parts, the part in the head, and the part in the template:

    this is what I currently have in my head at the moment:

    <script type='text/javascript'>
    var googletag = googletag || {};
    googletag.cmd = googletag.cmd || [];
    (function() {
    var gads = document.createElement('script');
    gads.async = true;
    gads.type = 'text/javascript';
    var useSSL = 'https:' == document.location.protocol;
    gads.src = (useSSL ? 'https:' : 'http:') +
    var node = document.getElementsByTagName('script')[0];
    node.parentNode.insertBefore(gads, node);
    <script type='text/javascript'>
    googletag.cmd.push(function() {
    googletag.defineSlot('/xxxx/on_ad_above_content_guests', [[234, 60], [468, 60], [728, 90]], 'div-gpt-ad-1425417951975-0').defineSizeMapping(mappingad_above_content).addService(googletag.pubads());
    googletag.defineSlot('/xxxx/on_ad_below_bottom_breadcrumb_guests', [[234, 60], [468, 60], [728, 90]], 'div-gpt-ad-1425417951975-1').defineSizeMapping(mappingad_below_bottom_breadcrumb).addService(googletag.pubads());
    <xen:if is="{$contentTemplate} == 'thread_view'">googletag.defineSlot('/xxxx/on_ad_message_below_guests', [[234, 60], [468, 60], [728, 90]], 'div-gpt-ad-1425417951975-2').defineSizeMapping(mappingad_message_below).addService(googletag.pubads());</xen:if>
    <xen:if is="in_array({$contentTemplate}, array('forum_list','member_notable','online_list'))">googletag.defineSlot('/xxxx/on_ad_sidebar2_guests', [250, 250], 'div-gpt-ad-1425417951975-3').addService(googletag.pubads());</xen:if>
    <xen:if is="in_array({$contentTemplate}, array('forum_list','member_notable','online_list'))">googletag.defineSlot('/xxxxx/on_ad_sidebar_guests', [250, 250], 'div-gpt-ad-1425417951975-4').addService(googletag.pubads());</xen:if>

Share This Page