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

Create variables in templates

Discussion in 'XenForo Development Discussions' started by infis, Dec 4, 2011.

  1. infis

    infis Well-Known Member

    How I can create a variable in a template and pass it for a helper?
    In particular, it is required to create a variable of type "array".
  2. Pepelac

    Pepelac Well-Known Member

    Like this
    <xen:set var="$avaUser.user_id">{xen:number $attributes.member}</xen:set>
    <xen:set var="$avaUser.username">{$nameHtml}</xen:set>
    {xen:helper dump, $avaUser}
  3. xfrocks

    xfrocks Well-Known Member

    If you just need to construct an array, you can also do this

    {xen:array 'key=value', 'anotherkey=anothervalue', 'foo=bar', 'visitorUserId={$visitor.user_id}'}
    DeltaHF, Marcus, infis and 1 other person like this.

Share This Page