Re: Re: how the get the length of array from smarty
"A.J. Brown" <[email protected]> Thu, 29 Sep 2005 08:57:54 -0400
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <008a01c5c4f5$6d333030$b203a8c0@ebizarch> |
Sure there is:
{if $array|@count > 0}
the @count will return the length of the array
Sincerely,
A.J. Brown
BitNotion Technologies
[email protected]
----- Original Message -----
From: "Anton Kovalenko" <[email protected]>
To: <[email protected]>; "James Mao" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, September 29, 2005 8:35 AM
Subject: [SMARTY-DEV] Re: how the get the length of array from smarty
> 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
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php