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

elseif shorthand?

Discussion in 'XenForo Development Discussions' started by Jaxel, Jun 28, 2016.

  1. Jaxel

    Jaxel Well-Known Member

    So you can do conditions in templates with:

    <xen:if is="$condition1">
    <xen:elseif is="$condition2"/>
        other stuff
        more stuff
    There is also a shorthand:

    {xen:if '$condition1', 'stuff', 'more stuff'}
    That shorthand can't do an "elseif". Is there a way I can do that shorthand?
  2. Jake B.

    Jake B. Well-Known Member

    {xen:if $condition1, 'something', '{xen:if $condition2, 'something', 'else'}'}

    should work, or something along those lines.
    Snog likes this.
  3. Snog

    Snog Well-Known Member

    Just don't enclose the second IF in quotes.

    {xen:if '{$value} == 1', 'X',{xen:if '{$value} == 2','XX','XXX'}}
    Jake B. likes this.
  4. Jaxel

    Jaxel Well-Known Member

    Yep. Thanks.

Share This Page