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

Template Syntax Inconsistency

Discussion in 'XenForo Questions and Support' started by James, May 22, 2011.

  1. James

    James Well-Known Member

    I didn't report this as a bug as it doesn't seem to be one.

    In the account_avatar_overlay template, the avatar code is:
    <img src="{xen:helper avatar, $visitor, l}" alt="{xen:phrase current_avatar}" />
    In the member_card template, the avatar code is:
    <img src="{xen:helper avatar, {$user}, l}" alt="" style="{xen:helper avatarCropCss, $user}" />
    In the member_card template, curly brackets are used around the user variable, but they're not used around the visitor variable. Does this mean that the curly brackets aren't needed?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It works either way. The curlies aren't required though.
  3. James

    James Well-Known Member

    Ah I see, I just noticed in the templates that one had them and one didn't. Thanks Jake.
  4. Kier

    Kier XenForo Developer Staff Member

    Curlies are not always required when dealing with a strict variable reference, unless its construction is complex.

    Yeah, it's complicated.
    ragtek, Forsaken and James like this.
  5. James

    James Well-Known Member

    So in the above case, was its construction considered complex (the member_card template) or was it just how one of you guys were feeling at the time and decided to throw curlies in? ;)
  6. Mike

    Mike XenForo Developer Staff Member

    It was written before the "simple" construction approach was available, most likely. :)
    Kier and James like this.

Share This Page