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

Template error :(

Discussion in 'Styling and Customization Questions' started by PreFiX, Mar 17, 2015.

  1. PreFiX

    PreFiX Member

    <xen:if is="empty({$transaction.ID})">
    {$transaction.servername}
    <xen:elseif is="is_numeric({$transaction.ID})">
    <a href="http://anotherdomain.com/?s={$transaction.ID}">{$transaction.servername}</a>
    <xen:else />
    <a href="http://{$transaction.ID}">{$transaction.servername}</a>
    </xen:if>

    The following templates contained errors and were not saved: prefixaddon_pagrindinis_list: 1) Line 13: Template syntax error.

    Line 13 is just below </xen:if> - </div>

    Or it's not even possible to use php functions here?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The correct syntax for elseif is:
    Code:
    <xen:elseif is="$blah" />
     
  3. PreFiX

    PreFiX Member

    Well I think than it will if it exists not if it's a number...
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You may have misunderstood - your code above doesn't have a closing / for the elseif.
     
  5. PreFiX

    PreFiX Member

    So you mean something like this?

    <xen:elseif is="is_numeric({$transaction.ID})" />

    The following templates contained errors and were not saved: prefixaddon_pagrindinis_list: 1) prefixaddon_pagrindinis_list - Line 8: Invalid condition expression
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

  7. PreFiX

    PreFiX Member

    Thanks solved with > and < :)
    But there should be function like is_numeric in my opinion.
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    These are the PHP functions you can use in conditional statements:
    • is_array
    • is_object
    • is_string
    • isset
    • empty
    • array
    • array_key_exists
    • count
    • in_array
    • array_search
    • preg_match
    • preg_match_all
    • strpos
    • stripos
    • strlen
    • trim
    • ceil
    • floor
    • round
    • max
    • min
    • mt_rand
    • rand
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    These are the PHP functions you can use in xen:calc:
    • abs
    • ceil
    • floor
    • max
    • min
    • pow
    • round
     

Share This Page