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

Setting a TRUE and FALSE Value

Discussion in 'XenForo Questions and Support' started by TazDevilLooney, Feb 6, 2011.

  1. TazDevilLooney

    TazDevilLooney Active Member

    Code for dummies! ;)

    I'm trying to get this peice of code to work but cant get the template to save without an error.

    I wish to set a NEW value to TRUE and use in a <xen:if> This is what i got...

    <xen:set var="$myvar">true</xen:set>
    <xen:if {$myvar}="true">
    This is true!
    <xen:else />
    This is False!
    <xen:if>

    Something so simple but can't understand why. [​IMG]
     
  2. Mike

    Mike XenForo Developer Staff Member

    Use 1 and 0 instead.
     
  3. TazDevilLooney

    TazDevilLooney Active Member

    Sorry, LOL, were would i place the 1 or 0, sorry for the dum question.
     
  4. Mike

    Mike XenForo Developer Staff Member

    As the value you're setting/testing against.
     
  5. TazDevilLooney

    TazDevilLooney Active Member

    <xen:set var="$myvar">1</xen:set>
    <xen:if {$myvar}="1">
    This is true!
    <xen:else />
    This is False!
    <xen:if>

    Still cant get it to save. Any iears [​IMG]
     
  6. Mike

    Mike XenForo Developer Staff Member

    I was assuming that was pseudocode, as the <xen:if> is syntatically wrong. This will suffice:

    <xen:if is="{$myvar}">
     
  7. TazDevilLooney

    TazDevilLooney Active Member

    Oh lovely jubbley, thankyou so much mike.

    final code if anyone else wants it

    1 = True
    0 = False

    <xen:set var="$myvar">1</xen:set>
    <xen:if is="{$myvar}">
    This is True
    <xen:else />
    This is Fause
    </xen:if>

    Nice one :)
     

Share This Page