oh, the line that says [% '</tr><tr>' UNLESS loop.count % num_columns %]">
should actually be [% '</tr><tr>' UNLESS loop.count % num_columns || loop.first %] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Stephen Howard Sent: Friday, May 24, 2002 08:55 AM To: Mike Melillo; 'Andy Wardley'; 'Randal L. Schwartz' Cc: 'David B. Bitton'; [EMAIL PROTECTED] Subject: RE: [Templates] HOWTO Implement Alternating Row Colors sure: [%- FOREACH object_id = objects.keys -%] [% '<table><tr>' IF loop.first %] [% '</tr><tr>' UNLESS loop.count % num_columns %]"> <td>[% result %]</td> [% '</tr></table>' IF loop.last %] [%- END -%] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Mike Melillo Sent: Friday, May 24, 2002 07:08 AM To: 'Andy Wardley'; 'Randal L. Schwartz' Cc: 'David B. Bitton'; [EMAIL PROTECTED] Subject: RE: [Templates] HOWTO Implement Alternating Row Colors This brings up something I was pondering the other day. If I have a long list of items that I wanted to display(from a DBI query), would it be possible to set up the template so that it was in a table of say 2 or 3 columns, rather than just a for loop of <tr><td>$result</td></tr> tags? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Andy Wardley Sent: Friday, May 24, 2002 3:09 AM To: Randal L. Schwartz Cc: David B. Bitton; [EMAIL PROTECTED] Subject: Re: [Templates] HOWTO Implement Alternating Row Colors On Thu, May 23, 2002 at 07:23:18PM -0700, Randal L. Schwartz wrote: > <tr bgcolor="[% colors.${loop.count % 2} %]"> Alas not. The parser only accepts simple terms inside ${ }, the same limitation as within ( ). You would need to use an intermediate variable. [% colno = loop.count % colors.size %] <tr bgcolor="[% colors.$colno %]"> This gets my award for "Most Annoying Limitation in the TT2 Parser". I don't think it can be solved easily in the state-driven TT2 parser, but it has already been "fixed" in the recursive descent TT3 parser. This is next on my list of TT3 modules to finish so hopefully we'll be able to graft the v3 parser into v2 at some point in the future. A _______________________________________________ templates mailing list [EMAIL PROTECTED] http://www.template-toolkit.org/mailman/listinfo/templates _______________________________________________ templates mailing list [EMAIL PROTECTED] http://www.template-toolkit.org/mailman/listinfo/templates _______________________________________________ templates mailing list [EMAIL PROTECTED] http://www.template-toolkit.org/mailman/listinfo/templates
