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

XF 1.1 Advert Per Node

Discussion in 'XenForo Questions and Support' started by lazer, Nov 5, 2013.

  1. lazer

    lazer Well-Known Member

    Hi all

    How would I condition the following 3 templates, so that they would not appear on one of my forum nodes (node 403)?

    This is a 3rd post ad block:
    Code:
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 2 AND !{$visitor.user_id}">
        <li class="post_advert message">
    
            <div class="messageUserInfo">
                <div class="messageUserBlock">
                    <div class="avatarHolder"><span class="avatar  av2m"><img  src="http://xxxxx.com/xf/styles/xxxx/xenforo/xenfocus/advatar.png"  width="96px" height="96px"></span></div>
    
                    <h3 class="userText" style="padding-bottom:10px;">
                        Google
                        <em class="userTitle" itemprop="title">Advertisement</em>
                    </h3>
    
                    <span class="arrow"><span></span></span>
                </div>
            </div>
    
          <div class="messageInfo">
                <div class="advert_content">
                        <xen:if is="!{$visitor.user_id}"><script type="text/javascript"><!--
    google_ad_client = "ca-pub-xxxxxxxxxxx";
    /* XF_728_Top_Above_Content */
    google_ad_slot = "xxxxxxxxx";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></xen:if>
                </div>
          </div>
          </li>
    </xen:if>
    This is the above content banner in thread_view:
    Code:
    <xen:if is="!{$visitor.user_id}"><br /><center><script type="text/javascript"><!--
    google_ad_client = "ca-pub-xxxxxxxxxx";
    /* Under Uniblue */
    google_ad_slot = "xxxxxxxxxxxx";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></center></xen:if>
    These are the thumbnail links above the breadcrumb:
    Code:
    <xen:hook name="ad_above_top_breadcrumb" />
    <xen:if is="!in_array({$contentTemplate}, array('error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'login', 'error_with_login'))">
    <xen:if is="!{$visitor.user_id}">
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-xxxxxxxxxx";
    /* Above Breadcrumb */
    google_ad_slot = "xxxxxxxxxxxxxx";
    google_ad_width = 728;
    google_ad_height = 15;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </xen:if>
    </xen:if>
    Thank you :D
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Wrap the contents in <xen:if is="{$forum.node_id} != 403">...</div>
     
  3. lazer

    lazer Well-Known Member

    Thanks Brogan. So, as an example, would the last one look like this? Not quite sure where to put the conditionals.

    Code:
    <xen:hook name="ad_above_top_breadcrumb" />
    <xen:if is="!in_array({$contentTemplate}, array('error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'login', 'error_with_login'))">
    <xen:if is="{$forum.node_id} != 403">
    <xen:if is="!{$visitor.user_id}">
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-xxxxxxxxxx";
    /* Above Breadcrumb */
    google_ad_slot = "xxxxxxxxxxxxxx";
    google_ad_width = 728;
    google_ad_height = 15;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </xen:if>
    </xen:if>
    </div>
    
     
    Last edited: Nov 5, 2013

Share This Page