Re: [SMARTY] while loop in smarty like ...
| From: | messju mohr | Date: | Mon, 18 Aug 2003 22:03:57 +0000 |
| Subject: | Re: [SMARTY] while loop in smarty like ... | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10092@lists.php.net to get a copy of this message | ||
On Mon, Aug 18, 2003 at 11:24:52PM +0200, Kai-Uwe Beyer wrote:
> Hi,
>
> is it possile to simulate a while loop like:
>
> while($movie = $movieIterator->next()){
>
> ...
> }
with smarty-2.6.0 you can make your block-function-plugins behave like
iterators. see:
http://smarty.php.net/manual/en/plugins.block.functions.php
(i just
noticed the fourth parameter "&$repeat" is missing in the
function-prototype on that page, i'll update that soon).
you'll have to implement you own little block-function and say
$repeat = $movieIterator->next()
in it. the block will be iterated until the next()-method returns false.
you can test this in 2.6.0-RC1. if your projects timeframe isn't to
short a stable release containing this ability may be out when you
need it for production.
greetings
messju
> $movieIterator is an iterator over a list of objects.
> The method returns for instance an object or false.
>
>
> bye
>
> Kai
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php