Hi 

I have a perl script (mod_perl) that connects to a DB (using 
APACHE:: DBI). I am trying to display 3 fields from all the records in 
a table (about 55 records). The records come back as an array 
reference (an array of arrays). I have been passing the arrayref to my 
templates like so: 

my $file = "test.atm";
my $vars = {
                data => @data,
               };
$tt->process($file,$vars)
        || die $tt->error;

At this point it gets scrappy - I can't find a way to display a 3 column 
table (or 3 anything) for each record. The best I can do is this:

[% FOREACH item = data %]
[% FOREACH i = item %]
<tr>
 <td>item1=[% i %]</td><td>item2=[% i.id 
%]</td><td>items=[%i.name %]</td>
</tr>
[% END %]
[% END %]
</table>

This just gives me a single column long list with one field per row 
(about 155 rows). I know i.id and i.name are meaningless in this 
context, they are there to show what I'd really like. 

I am pretty sure that I should be using another variable in the 2nd 
FOREACH iterator but can work out from the docs how to do it. 
Can someone spell it out for me?
 
Thanx.
Dp.


PS: Sorry if this mail has been received twice but I re-sent as I hadn't received a 
copy 
from the list.
~~
Dermot Paikkos * [EMAIL PROTECTED]
Network Administrator @ Science Photo Library
Phone: 0207 432 1100 * Fax: 0207 286 8668


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates

Reply via email to