Hi,
I am trying to create a 3 column table. I and am getting stuck and
have a few questions. My first question is does the use of the table
directive mean that I don't need to use HTML tags such as <table>,
<tr> and <td>? It seems that I do still need them.
I want the table to be ordered across so I used the examples at
~/docs/modules/Template/Plugin/Table.html so my template looks like
this:
<table>
[% USE table(src, rows=3, pad=0) %]
[% FOREACH col = table.cols %]
<tr>
[% FOREACH item = col %]
<td><img src="[% item.img %]"><br>[% item.name %]</td>
[% END %]
</tr>
[% END %]
</table>
src is a reference to an array of hashes.
My problem is that under each row created by item, I want another row
with [% item.name %]. In the example above I am using a <br> tag to
force the name under the img src. So I am try to generate HTML source
that looks like:
<tr>
<td><img src="/thumbs/1.jpg"></td>
<td><img src="/thumbs/2.jpg"></td>
<td><img src="/thumbs/3.jpg"></td>
</tr>
<tr>
<td>name1</td>
<td>name2</td>
<td>name3</td>
</tr>
Is it possible to reference the elements of the item array EG:
item(0) or similar? If so I could create variables to hold the names
as I loop though the items.
Sorry if I am being dumb. It looks like there are plenty of methods
with Table and I should be able to find the right combination to
achieve what I want but I can't quite grasp the right combination.
TIA,
Dp.
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates