[Templates] While loop iterator problem
[prev]
[thread]
[next]
[Date index for 2005/01/18]
Hello
I am assigning a Class::DBI::Iterator as follows:
my $years = OMAC::Event->search_archive_years();
This method executes the following SQL statement:
SELECT DISTINCT YEAR(start_date) AS year
FROM __TABLE__
WHERE end_date < CURRENT_DATE()
ORDER BY year DESC
I then pass this iterator into a template and try to use it as follows:
[% WHILE (year = years.next) %]
[% years.year %]
[% END %]
However, the loop never executes. There are two rows returned from the
database.
This works but is a bit messy and shouldn't be necessary!:
[% WHILE i < years.count %]
[% years.next.year %]
[% i = i + 1 %]
[% END %]
It's worthing noting that I have successfully used the first syntax
elsewhere in the same template but on a different iterator.
Any ideas?
Thanks
Jon
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
[Templates] While loop iterator problem
Jonathan Tweed 12:14 on 18 Jan 2005
|