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

XF 1.5 Conditional in xen:select

Discussion in 'Styling and Customization Questions' started by Snog, Oct 14, 2016.

  1. Snog

    Snog Well-Known Member

    Are conditionals processed in a template's xen:select section?

    I've tried various iterations of this and none of them seem to work...
    <xen:select name="default_sort_order" value="{$forum.default_sort_order}" inputclass="autoSize">
       <xen:option value="last_post_date">{xen:phrase last_message}</xen:option>
       <xen:option value="post_date">{xen:phrase start_date}</xen:option>
       <xen:option value="title">{xen:phrase title}</xen:option>
       <xen:option value="reply_count">{xen:phrase replies}</xen:option>
       <xen:option value="view_count">{xen:phrase views}</xen:option>
       <xen:if is="{$forum.node_id} == 3"><xen:option value="addon_value">{xen:phrase addon_phrase}</xen:option></xen:if>
    Last edited: Oct 14, 2016
  2. Chris D

    Chris D XenForo Developer Staff Member

    I don't think so as far as I can recall. This would therefore require duplicating the entire select inside the conditional or if you can prepare the options in PHP and send it to the template then you can pass that array through to an <xen:options source="" /> tag.

    FWIW you can do this in XF2 and it supports for each tags inside too.
    Snog likes this.
  3. Snog

    Snog Well-Known Member

    Thanks Chris.

    And it can all be done through template modifications too using xen:array. :D
  4. Chris D

    Chris D XenForo Developer Staff Member

    Yes very true!

Share This Page