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

Lack of Interest Allow Variable Override in Templates

Discussion in 'Closed Suggestions' started by James, Aug 5, 2011.

  1. James

    James Well-Known Member

    I'd like to be able to override variables that already exist in templates.

    <xen:set var="{$user.username}">My String</xen:set>
    Which will replace all occurrences of {$user.username} with My String.

    Why do I want this? It makes things like this easier!

    (If this is possible I obviously did it wrong :D)
  2. Mike

    Mike XenForo Developer Staff Member

    I'm not sure if we support setting array elements and that's what you're bringing up, or if you're proposing the <xen:set /> tag... but we already have <xen:set var="$name">value</xen:set> :) It's done on a per template level. It doesn't really look like what you want to do is at the template level though. Filtering controller responses seems like the best thing to do.
  3. James

    James Well-Known Member

    I know <xen:set /> exists, I was just looking for a simple way to override a pre-set variable in a template.
    <xen:set var="{$thread.username}">Some random user</xen:set>

    It probably isn't something that should be done at template level, but I suggested it to get an opinion.

Share This Page