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

What is wrong with this template?

Discussion in 'XenForo Development Discussions' started by tyteen4a03, Aug 21, 2013.

  1. tyteen4a03

    tyteen4a03 Well-Known Member

    I can't find the error... It is throwing one at line 4 after I added xen : checked in there.

    Code:
    <xen:require css="3ps_usergroup_ranks_admin.css" />
    
    <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>
    
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Try {xen:selected instead of {xen:checked
     
  3. tyteen4a03

    tyteen4a03 Well-Known Member

    Same error.

    Using 1.1.
     
  4. tyteen4a03

    tyteen4a03 Well-Known Member

    Can @Mike confirm that you can't use curly xen functions in xen tags? What would be the correct way of implementing this?
     
    Last edited: Aug 21, 2013
  5. Lawrence

    Lawrence Well-Known Member

    Try this:
    selected="{$preparedOption.option_value.display.posts}"
     
  6. tyteen4a03

    tyteen4a03 Well-Known Member

    selected="1" or selected="0" are not valid HTML.
     
  7. Lawrence

    Lawrence Well-Known Member

    This is a piece of template code from my roster add-on where the values are either a 1 or a 0, and this works:

    Code:
                    <xen:checkboxunit label="{xen:phrase options}:">
                        <xen:option name="strict" selected="{$roster.strict}" label="{xen:phrase iwdrp_strict_group_membership}"
                            hint="{xen:phrase iwdrp_members_can_only_groups_they_belong_to}" />
                        <xen:option name="sidebar" selected="{$roster.sidebar}" label="{xen:phrase iwdrp_include_a_sidebar}"
                            hint="{xen:phrase iwdrp_include_a_sidebar_with_this_rosters_page}" />
                        <xen:option name="active" selected="{$roster.active}" label="{xen:phrase iwdrp_roster_is_active}"
                            hint="{xen:phrase iwdrp_use_this_to_temporarily_disable_this_roster}" />
                    </xen:checkboxunit>
    and the source that is produced:
    HTML:
                <dl class="ctrlUnit">
                    <dt>Options:</dt>
                    <dd>
                        <ul>
    <li><label for="ctrl_strict_1"><input type="checkbox" name="strict" value="1" id="ctrl_strict_1" /> Strict group membership</label> <p class="hint">Members can only view groups they belong to.</p></li>
    <li><label for="ctrl_sidebar_1"><input type="checkbox" name="sidebar" value="1" id="ctrl_sidebar_1" checked="checked" /> Include a sidebar</label> <p class="hint">Include a sidebar with this roster's page.</p></li>
    <li><label for="ctrl_active_1"><input type="checkbox" name="active" value="1" id="ctrl_active_1" checked="checked" /> Roster is active</label> <p class="hint">Use this to temporarily disable this roster.</p></li>
    </ul>
                    </dd>
                </dl>
     
  8. tyteen4a03

    tyteen4a03 Well-Known Member

    HTML as shown in Inspect Elements or View Source Code?
     

Share This Page