<xen:container var

Chris D

XenForo developer
Staff member
I think I'm overlooking something.

I would like to set a variable in a template, and have it available to use in the PAGE_CONTAINER. This is usually done like this:

Code:
<xen:container var="$head.canonical"><link rel="canonical" href="{xen:link 'canonical:index'}" /></xen:container>
Then in the PAGE_CONTAINER template, the {$head} variable is available.

I'd like to do something similar, e.g.

Code:
<xen:container var="$foo.bar">1</xen:container>
But when I do, in PAGE_CONTAINER:

Code:
{xen:helper dump, $foo}
The value returned is NULL.

So clearly I'm missing something, but I can't think what.
 

CyberAP

Well-known member
You need to set your var first.

Code:
<xen:set var="$foo"></xen:set>

<xen:container var="$foo">bar</xen:container>
 

Chris D

XenForo developer
Staff member
That still doesn't work, unfortunately.

<xen:container var="" should be setting the contents of the var to be used in the container. But again either way, it is still NULL.
 

Chris D

XenForo developer
Staff member
Update.

Courtesy of @Jake Bunce problem is my template where I was defining the container var is actually contained in the container template already.

This works fine if I use the <xen:container tags in content template or templates included by the content template.
 
Top