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

XF 1.3 Conditionals Question

Discussion in 'XenForo Questions and Support' started by toodlez, Jul 27, 2014.

  1. toodlez

    toodlez Active Member

    I want to have a conditional to not show something on specific templates AND specific nodes at the same time... How would I accomplish this?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    <xen:if is="!in_array({$contentTemplate}, array('template_1', 'template_2')) AND !in_array({$forum.node_id}, array(x, y, z))">
     
    toodlez likes this.
  3. toodlez

    toodlez Active Member

    This is what I have...

    Code:
    <xen:if is="!in_array({$contentTemplate}, array('message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'register_facebook', 'register_twitter', 'register_google', 'login', 'error_with_login', 'contact')) AND !in_array({$forum.node_id}, array('node-83'))">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Forum Footer -->
    <ins class="adsbygoogle" style="display:inline-block;width:970px;height:90px" data-ad-client="ca-pub-2735863251480471" data-ad-slot="6136959148"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </xen:if>
    But it's still showing on node 83, what do I have incorrectly input?

    Thanks @Brogan
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Change node-83 to 83.
     
  5. toodlez

    toodlez Active Member

    I made it this:

    Code:
    <xen:if is="!in_array({$contentTemplate}, array('message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'register_facebook', 'register_twitter', 'register_google', 'login', 'error_with_login', 'contact')) AND !in_array({$forum.node_id}, array('83'))">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Forum Footer -->
    <ins class="adsbygoogle" style="display:inline-block;width:970px;height:90px" data-ad-client="ca-pub-2735863251480471" data-ad-slot="6136959148"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </xen:if>
    Still showing up though on node 83 (which is a page node for privacy policy)
     
  6. AndyB

    AndyB Well-Known Member

    Try removing the single quotes around the 83.
     
  7. toodlez

    toodlez Active Member

    No such luck, unless my computer isn't reflecting the changes right away, so far no luck with this
     
  8. toodlez

    toodlez Active Member

    If I put node-83 without '' around it, then I get an expression error... if I put just 83 with no '' or with '' around it it doesn't work
     
  9. toodlez

    toodlez Active Member

    I just did this on forum node #4

    Code:
    <xen:if is="!in_array({$contentTemplate}, array('message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'register_facebook', 'register_twitter', 'register_google', 'login', 'error_with_login', 'contact')) AND !in_array({$forum.node_id}, array(4))">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Forum Footer -->
    <ins class="adsbygoogle" style="display:inline-block;width:970px;height:90px" data-ad-client="ca-pub-2735863251480471" data-ad-slot="6136959148"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </xen:if>
    It worked.. does it make a difference that the node I'm trying to remove it from is a page node?
     
  10. Brogan

    Brogan XenForo Moderator Staff Member

    Err, yes... $forum.node_id
     
  11. toodlez

    toodlez Active Member

    Huh?
     
  12. Brogan

    Brogan XenForo Moderator Staff Member

    You're trying to use $forum.node_id for a page node.

    Try using $page.node_id, or $quickNavSelected (e.g. !in_array({$quickNavSelected}, array('node-83')).
     
  13. toodlez

    toodlez Active Member

    I tried the quicknavselected option and it works.

    +1 @Brogan thank you for your input sir!
     

Share This Page