• 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

toodlez

Active member
#1
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?
 

Brogan

XenForo moderator
Staff member
#2
<xen:if is="!in_array({$contentTemplate}, array('template_1', 'template_2')) AND !in_array({$forum.node_id}, array(x, y, z))">
 

toodlez

Active member
#3
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
 

toodlez

Active member
#5
Change node-83 to 83.
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)
 

toodlez

Active member
#8
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
 

toodlez

Active member
#9
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?
 

Brogan

XenForo moderator
Staff member
#12
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')).