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

Not a Bug Cannot use curly style template function in <xen> tags

Discussion in 'Resolved Bug Reports' started by tyteen4a03, Aug 22, 2013.

  1. tyteen4a03

    tyteen4a03 Well-Known Member

    Title.

    Example code:

    Code:
    <xen:checkboxunit label="{$preparedOption.title}" name="{$fieldPrefix}[{$preparedOption.option_id}]" hint="{$preparedOption.hint}">
       <xen:option name="{$fieldPrefix}[{$preparedOption.option_id}][display][posts]" label="{xen:phrase 3ps_usergroup_ranks_in_posts}" {xen:checked $preparedOption.option_value.display.posts}>
         <xen:select name="{$fieldPrefix}[{$preparedOption.option_id}][display_position][posts]" value="{$preparedOption.option_value.display_position.posts}">
           <xen:option value="0">{xen:phrase 3ps_usergroup_ranks_over_avatar}</xen:option>
           <xen:option value="1">{xen:phrase 3ps_usergroup_ranks_under_avatar}</xen:option>
           <xen:option value="2">{xen:phrase 3ps_usergroup_ranks_above_username}</xen:option>
           <xen:option value="3">{xen:phrase 3ps_usergroup_ranks_under_user_title}</xen:option>
         </xen:select>
       </xen:option>
       <xen:explain>{xen:raw $preparedOption.explain}</xen:explain>
       <xen:html>
         <input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />
         {xen:raw $editLink}
       </xen:html>
    </xen:checkboxunit>
    
    Notice that the compiler will throw a fit on line 2 about xen:checked being there. Replace xen:checked with xen : if, xen:escape or any other functions, it will also throw a fit.

    I also noticed that all admin templates that require the use of functions uses the input tag instead of xen : option, so this might be a suggestion instead.
     
    Last edited: Aug 22, 2013
  2. xf_phantom

    xf_phantom Well-Known Member

    it's just
    selected="{$preparedOption.option_value.display.posts}


    Take a look at the template "option_template_captcha" which is probably similar to what you need
     
    Last edited: Aug 22, 2013
  3. tyteen4a03

    tyteen4a03 Well-Known Member

    I just figured, but this bug involves all functions and not just checked/selected.
     
  4. Mike

    Mike XenForo Developer Staff Member

    Of course you can't - that's not how the template syntax works... You have to write valid HTML-esque syntax.
     
  5. tyteen4a03

    tyteen4a03 Well-Known Member

    Would be inconvenient if we want to add attribute based on conditionals, but fair enough.
     

Share This Page