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

Conditional not being evaluated in Advertising System

lantek

Active member
#1
OK thanks. I'm outside of ticket support scope now, so have been asked to post in the forum.

If using the 'Container Breadcrumb (top): Above' ad unit, would there be any alternative to making the following work?

<xf:if is="{$forum.node_id} == 4">
content here
</xf:if>

Many thanks for any help.
 

Chris D

XenForo developer
Staff member
#2
HTML:
<xf:if is="$__globals.forum.node_id == 4">
content here
</xf:if>
That should work as long as the forum variable is passed up to the container template.
 

Brogan

XenForo moderator
Staff member
#5
To add some context and to reiterate what I said in the ticket, you can check what params/variables are available in the template by adding this to the ad unit:
Code:
{{ dump(vars()) }}
Then searching for node_id on the page gives this:

1512060168451.png

However, $forum is not available in that form but if you scroll up you can see it is within __globals:
1512060258877.png

So the full param is __globals.forum.node_id.
 

lantek

Active member
#6
To add some context and to reiterate what I said in the ticket, you can check what params/variables are available in the template by adding this to the ad unit:
Code:
{{ dump(vars()) }}
Then searching for node_id on the page gives this:

View attachment 162890

However, $forum is not available in that form but if you scroll up you can see it is within __globals:
View attachment 162891

So the full param is __globals.forum.node_id.
Thanks, very helpful!