Re: [SMARTY] Another array related question
| From: | Nancy Milligan | Date: | Mon, 14 Apr 2003 21:49:51 +0000 |
| Subject: | Re: [SMARTY] Another array related question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9256@lists.php.net to get a copy of this message | ||
Is count undocumented? I have:
Table of Contents
count_characters
count_paragraphs
count_sentences
count_words
In the docs, but I'm not seeing anything about count. Perhaps I'm missing
out on something!
Nancy
----- Original Message -----
From: "luis" <luis@fuegolabs.com>
To: "'Nancy Milligan'" <npm@cox.net>; <smarty-general@lists.php.net>
Sent: Monday, April 14, 2003 1:30 PM
Subject: RE: [SMARTY] Another array related question
> {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.
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>