Re: Limiting the section loop
| From: | Anders Janson | Date: | Tue, 26 Jun 2001 08:23:32 +0000 |
| Subject: | Re: Limiting the section loop | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-981@lists.php.net to get a copy of this message | ||
Andrei Zmievski wrote:
>
> > A much neater way would be to write something like:
> > {section name=foo loop=$bar limit=7}
> >
> > And for compatibility, "limit" should be optional, with a default of
> > "all".
>
> You can just specify the limit directly in the loop:
>
> {section name=foo loop=7}
>
> ...
>
> {/section}
>
Good to know, but this is not really a limit. It forces the loop to run N
times.
What I was looking for was a way to limit it to *max* N times. This does not
work properly if my data array(s) are shorter than N elements.
/Anders Janson