Re: how the get the length of array from smarty
| From: | Anton Kovalenko | Date: | Thu, 29 Sep 2005 12:35:45 +0000 |
| Subject: | Re: how the get the length of array from smarty | ||
| References: | 1 | Groups: | php.smarty.dev php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2784@lists.php.net to get a copy of this message | ||
There's no straight way to findout array legnth.
1. You may use Smarty's ability to execute php code inside templates
2. You can create an object of a class which has method, calculating
count($a) and returning the result
And about null?
I think {if $a == null} should work.
James Mao wrote:
> hi,
>
> 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?
>
> Thanks,
> James