[PHPTAL] Resetting a collection's index
romtek at gmail.com
Fri Dec 11 06:46:51 CET 2009
2009/12/10 Kornel Lesiński <kornel at aardvarkmedia.co.uk>
> On 09-12-2009 at 23:22:11 romtek <romtek at gmail.com> wrote:
> What is an approach to use if there's a need to iterate over the same
>> collection more than once in a template? Currently, it seems that a
>> collection's index/pointer is set at the end of the collection, and
>> iteration isn't possible.
> As far as I'm aware PHPTAL iterates exactly like PHP's foreach() does, and
> does reset collections when necessary (verified in
> Does your collection work with foreach()? If it does, can you send me the
> code that doesn't work in PHPTAL?
Evidently, the problem is only with PDOStatement data type. It is
traversable with foreach(), but it looks like it can't be reset (
http://www.php.net/manual/en/class.pdostatement.php). That's probably OK
because I usually move data into an array before giving the result to a
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PHPTAL