>>>>> "Till" == Till Quack <[EMAIL PROTECTED]> writes:
Till> I am new to the Template toolkit and I am having trouble finding a good
Till> method to do the following:
Till> A Table of images with descriptions where the descriptions are in a
Till> separate row, the table should be c columns wide, i.e. with 2 columns
Till> <table>
Till> <tr><td><img src="img1"><td><td><img src="img2"><td></tr>
Till> <tr><td>description 1<td><td>description 2<td></tr>
Till> <tr><td><img src="img3"><td><td><img src="img4"><td></tr>
Till> <tr><td>description 3<td><td>description 4<td></tr>
Till> ....
Till> </table>
Till> Currently I get the data as multidimensional array immages, so I started
Till> with
Till> <table >
Till> <tr >
Till> [% FOREACH image = images %]
Till> <td align="center" valign="middle">
Till> <img src="[%image.0%]" alt="dummy" height="100"
Please don't put "dummy". Either leave it out, or put a valid alt
text there. You don't want a blind screenreader saying "dummy, dummy,
dummy" over and over again, do you?
Till> width="100"></td>
Till> The description would be in image.1
Till> ....
Till> But I am stuck here - how do I achieve the scenario as described above?
Use the table plugin. You want "rows = 2", then ask for each "col".
I know it's sideways, but you're printing across, not down. :)
[%
USE table(images, rows = 2);
"<table>";
FOREACH myrow = table.cols;
"<tr>"; # image row
FOREACH mycell = myrow;
"<td>";
mycell.0 is your image.0
"</td>";
END;
"</tr>";
"<tr>"; # description row
FOREACH mycell = myrow;
"<td>";
mycell.1 is your image.1
"</td>";
END;
"</tr>";
END;
"</table>";
%]
The table plugin is darn simple at first glance, but it's amazing
how many cool things can be done with it.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates