Page 1 of 1

check smarty var is integer in template

Posted: Tue Jan 27, 2015 3:04 pm
by Timbalu
Its a real pity we do not allow is_int($foo) or is_numeric($foo) by security as default for smarty.
So you cannot check for a numeric or have to create & use a modifier {$oo|intval}.

I almost gave up on this, but then I remembered casting to be allowed, so

Code: Select all

{if (int)$foo} will do {/if}
;-)