XF 2.1 Need help with a conditional array for nodes to not display ads


Well-known member
I am trying to restrict ads from showing on certain pages and in certain nodes.

So I have this to not display on the main forum index and it works:

<xf:if is="$xf.reply.template !== 'forum_list'"> followed by the ad code and the closing </xf:if>.

Now I tried to restrict display from certain nodes in an array but this does not work:

<xf:if is = "!in_array($forum.node_id, [302,293,291,294,323,298,301,290,296,288,320,319,321,318])">

What am I doing wrong with that array?

Also, eventually I want to combine the two, possibly with templates in an array as well. Any help with how to do that?


Well-known member
This should work to combine them and allow the nodes to work through the ad system ( it needed __globals)

<xf:if is="$xf.reply.template !== 'forum_list' AND !in_array($__globals.forum.node_id, [302,293,291,294,323,298,301,290,296,288,320,319,321,318])">


Well-known member
If I want to add another template or two to that conditional, should I just use AND and add the other(s)?

Or would it be better to put the templates into an array as well?