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

Conditionals Documentation

Discussion in 'Styling and Customization Questions' started by limboclub, Feb 18, 2013.

  1. limboclub

    limboclub Member

    I was sure there was doco for conditionals but when searching I can only find support requests for specific issues (none of which match my issue).

    Can someone link to this?

    If there is none, can anyone tell me why this simple if/else if/else doesn't work?

    <xen:if is="{$forum.node_id} == 52">
    CODE A
    <xen:if is="{$forum.node_id} == 21" />
    CODE B
    <xen:else />
    CODE
    </xen:if>

    On forum 52 it shows both CODE A and CODE B.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    You need this:

    <xen:if is="{$forum.node_id} == 52">
    CODE A
    <xen:elseif is="{$forum.node_id} == 21" />
    CODE B
    <xen:else />
    CODE
    </xen:if>
     
    Jake Bunce and limboclub like this.
  3. Russ

    Russ Well-Known Member

    Jake Bunce likes this.
  4. limboclub

    limboclub Member

    All good, but a new wrinkle appears when I try to nest:

    <xen:if is="{$forum.node_id} == FORUM A">
    <xen:if is="{$user.user_id} == NUMBER">
    CODE A1
    <xen:else />
    CODE A2
    </xen:if>
    <xen:elseif is="{$forum.node_id} == FORUM B" />
    CODE B
    <xen:else />
    CODE C
    </xen:if>

    I put my own user_id in at NUMBER, but it still shows CODE A2.
     

Share This Page