Sunday 15 October 2006 8:24:59 am
Just count the elements - if the count is zero the array is empty.
{def $foo = array()}
{if $foo|count()|eq(0)}
the array is empty
{else}
the array is not empty
{/if}
Actually most of the if condition is not strictly necessary:
{if $foo} should evaluate to true if the array contains something and to false otherwise
{if $foo|count()} should evaluate to true if the array contains something and to false otherwise but as this is not clearly mentioned in the documentation (or I have not found it), I would not rely on such shortcuts. Greetings from Luxembourg Claudia
|