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

<xen:container var

Discussion in 'XenForo Development Discussions' started by Chris D, Jun 16, 2013.

  1. Chris D

    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:

    <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.

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

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

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

    CyberAP Well-Known Member

    You need to set your var first.

    <xen:set var="$foo"></xen:set>
    <xen:container var="$foo">bar</xen:container>
  3. Chris D

    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.
  4. Chris D

    Chris D XenForo Developer Staff Member


    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.
    Jake Bunce likes this.

Share This Page