Conditional not being evaluated in Advertising System

lantek

Active member
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.
 
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.webp

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

So the full param is __globals.forum.node_id.
 
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!
 
Bumping this thread as I'm using the advertisement system as well.

Is there a conditional for finding the parent category like XF1? I'm not seeing any reference to parent/category when dumping the vars aside from a breadcrumb reference.
 
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.

For some reason I can't dump $__globals variables. Any idea what I'm doing wrong?

I've this with no luck.
Code:
{{ dump($__globals) }}
{{ dump($__globals.forum.node_id) }}


This works fine, but I still don't see __globals on the list.
Code:
{{ dump(vars()) }}
 
Top Bottom