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

XF 1.1 <xen: else /> in xenforo

Discussion in 'XenForo Questions and Support' started by nguyenhuuhung, Oct 1, 2013.

  1. nguyenhuuhung

    nguyenhuuhung Active Member

    I creat Custom User Fields " gender"

    I Want.

    If the user selects gender is Nu. Display image /images/gender/Nu.gif

    If the user selects gender is Nam. Display image /images/gender/Nam.gif

    Crossbred

    /images/gender/Unknow.gif

    But ,All They display images/gender/Unknow.gif

    Why???


    <dt>My Gender:</dt> <img src="./images/gender/<xen:if is="{$user.customFields.gender}=='Nam'">Nam<xen: else /><xen:if is="{$user.customFields.gender}=='Nu'">Nu<xen:else />Unknow</xen:if></xen:if>.gif" border="0" alt="gender"></img>

    Please give me the correct command
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Paste {$user.customFields.gender} elsewhere in the template so you can view the output on the page. Verify the value stored in that variable.
     
    nguyenhuuhung likes this.
  3. nguyenhuuhung

    nguyenhuuhung Active Member

    I do not understand your answer very
    I use it in message_user_info
    But ,All They display images/gender/Unknow.gif

    Why??
     
    Last edited: Oct 1, 2013
  4. Jeremy

    Jeremy Well-Known Member

    Place it outside of the conditional, to verify its value.
     
  5. nguyenhuuhung

    nguyenhuuhung Active Member

    Now,How do i must??
    You can rewrite for me?
     
  6. Jeremy

    Jeremy Well-Known Member

    Do as Jake instructs and place that code anywhere else in the template.
     
  7. Jeremy

    Jeremy Well-Known Member

    Also, your xen else shouldn't include a space.
     
    Liam W likes this.

Share This Page