[Templates] Table formatting with out EVAL_PERL

[prev] [thread] [next] [Date index for 2004/05/06]

From: James Lance
Subject: [Templates] Table formatting with out EVAL_PERL
Date: 20:13 on 06 May 2004
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a question about use TT to format HTML tables in to predefined colum=
n=20
widths.

I am passing in an array of elements.  I want to display the contents of th=
at=20
array in an table that is 3 columns wide, and how ever many rows are needed=
=20
to show the data. =20

I have come up with a solution that works well for me, but I am wondering i=
f=20
there is a way to accomplish this same thing with out enabling EVAL_PERL

Here is the code I am currently using (some what simplified for clarity):

<table border=3D"0" cellspacing=3D"2" cellpadding=3D"1">
  <tr>
    [%- FOREACH image IN images -%]
      [%- PERL -%]
        if (((([% loop.count %]-1) % 3) =3D=3D 0) && ([% loop.count %] !=3D=
 1)) {
        print "</tr><tr>";
        }
      [%- END -%]
      [%- PROCESS image -%]
    [%- END -%]
  </tr>
</table>
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAmpx1xwWH9N2FUHoRAttlAKDVYidqbyJqrXpgk7HM7EoqQHjs/gCff5ru
4teLDAmqZJ3lx9Jnz4c3yM8=3D
=3DoTwB
=2D----END PGP SIGNATURE-----


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Table formatting with out EVAL_PERL
James Lance 20:13 on 06 May 2004

Re: [Templates] Table formatting with out EVAL_PERL
Perrin Harkins 20:18 on 06 May 2004

Re: [Templates] Table formatting with out EVAL_PERL
darren chamberlain 21:34 on 06 May 2004

Re: [Templates] Table formatting with out EVAL_PERL
Perrin Harkins 22:13 on 06 May 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52