On an IRC server far, far away:
15:14 <@Ranguard> Anyone know how to make TT::Plugin::Table put the
data across columns rather than down, there must be a flag or
something, rather than having to take a row and play around with it
(as in the docs example)
15:15 <@acme> Ranguard: you have to take a row and play with it: [%
USE table(entries, rows=3, pad=1) %][% FOREACH cols = table.cols %][%
FOREACH item = cols %] [% item %] [% END %] [% END %]
15:17 <@Ranguard> acme: ahh, was hoping I coudl just flip a switch,
but thanks for the example, makes more sense now :)
15:23 <@acme> Ranguard: i'll patch the docs
15:24 <@Ranguard> acme: cheers, I guessed from the docs that you could
do something like that, but it wasn't very clear, patch would be cool
:)
Actually, I almost always want to order tables this way, so here is a
proposed patch to docsrc/src/Modules/Template/Plugin/Table.tt2.
Cheers, Leon
--
Leon Brocard.............................http://www.astray.com/
Nanoware...............................http://www.nanoware.org/
... Hi. I'll be your tagline for this evening
Index: docsrc/src/Modules/Template/Plugin/Table.tt2
===================================================================
RCS file: /template-toolkit/Template2/docsrc/src/Modules/Template/Plugin/Table.tt2,v
retrieving revision 1.1
diff -u -r1.1 Table.tt2
--- docsrc/src/Modules/Template/Plugin/Table.tt2 2001/03/29 22:10:51 1.1
+++ docsrc/src/Modules/Template/Plugin/Table.tt2 2002/01/21 15:24:29
@@ -146,6 +146,21 @@
. .
.
+Example code to do so would be much like the following:
+
+ [% USE table(alphabet, rows=3) %]
+ [% FOREACH cols = table.cols %]
+ [% FOREACH item = cols %]
+ [% item %]
+ [% END %]
+ [% END %]
+
+ a b c
+ d e f
+ g h i
+ j . .
+ .
+
In addition to a list reference, the Table plugin constructor may be
passed a reference to a Template::Iterator object or subclass thereof.
The get_all() method is first called on the iterator to return all