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

No ad on login page

Discussion in 'Styling and Customization Questions' started by LPH, Apr 27, 2012.

  1. LPH

    LPH Well-Known Member

    Hi,

    The ads should not show on the login page or create thread page. This is my current code for the template ad_above_content. What should be changed to keep the ad off the login page?

    Code:
    <xen:if is="{$contentTemplate} != 'thread_create'">
     
    <xen:hook name="ad_above_content" />
     
    <div align="center">
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-xxxxx";
    /* Tux Reports Network */
    google_ad_slot = "xxxxx";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>
     
    </xen:if>

    This keeps it off the login page.

    Code:
    <xen:if is="{$contentTemplate} != 'login'">
     
    <xen:hook name="ad_above_content" />
     
    <div align="center">
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-xxxxx";
    /* Tux Reports Network */
    google_ad_slot = "xxxxx";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>
     
    </xen:if>
    So - how do I combine the xen:if statements?

    is is xen:if and xen:if else ...?

    Update: Figured it out. I was using the OR and should have used AND

    Code:
    <xen:if is="{$contentTemplate} != 'thread_create' AND {$contentTemplate} != 'login'">
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This syntax is more easily extended:

    Code:
    <xen:if is="!in_array({$contentTemplate}, array('thread_create', 'login'))">
    
     
  3. LPH

    LPH Well-Known Member

    That is much more elegant.
     

Share This Page