2009/12/10 Kornel Lesiński <kor...@aardvarkmedia.co.uk>

> On 09-12-2009 at 23:22:11 romtek <rom...@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
>> another
>> 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
> tests/TalRepeatTest.php/testReset).
>
> 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
template, anyway.
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to