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



Reply via email to