RE: [SMARTY] Another array related question
| From: | luis | Date: | Mon, 14 Apr 2003 20:30:09 +0000 |
| Subject: | RE: [SMARTY] Another array related question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9255@lists.php.net to get a copy of this message | ||
{if count($foo)>0}
Something if the array has elements
{else}
{/if}
Note: If you are looping an array and want a special behaviour if the
array is empty use instead:
{section name=ix loop=$foo}
code
{sectionelse}
code if empty array
{/section}
If you want the keys of the array then may I ask what do you want to do
with the keys? :-) Smarty foreach or section loops can be used depending
on what you want to do.
-----Original Message-----
From: Nancy Milligan [mailto:npm@cox.net]
Sent: Monday, April 14, 2003 5:16 PM
To: smarty-general@lists.php.net
Subject: [SMARTY] Another array related question
Is there anyway in Smarty to find out the number of elements in an
array? Or is there a way to return all the keys of an array as an
array? Or do people usually create some PhP code inside a Smarty
template to handle that?
Thanks!
Nancy M.