Re: [SMARTY-DEV] how the get the length of array from smarty

[email protected] (pbaker) Thu, 29 Sep 2005 14:20:52 +0200
Newsgroups php.smarty.dev
Message-ID <[email protected]>
Hi James,

> i have an array in the template file $users, how can i determin the 
> length of this array, so that if the length is zero i can output some
> desc strings.
> And another question is how can i determine if the variable is NULL?

if U assign the $users array in php script ($smarty->assign('users','somearray');)
U can check the length of array before it, and then if the length != 0
just assign to "users"

if the length == 0 put a message

U must to use {if ...} {/if} tags in template

Best regards,
pbaker