Hi,
Just joined this list to see if anyone could answer this:
I am trying to get hold of the Template Toolkit views. I am using:
TT version 2.19
If I make a .tt2 file like
[% form.render %]
all form fields are showing up - OK.
Now I want do my own layout and as I understood the DOCS all fields are saved
in a hash field or array fields.
All my fields are defined in a .fb file
If I do:
[% FOREACH field IN form.fields %]
<tr>
<td>[% field.label %]</td>
<td>[% field.name %]</td>
<td>[% field.field %]</td>
</tr>
[% END %]
The output is OK but as I understood the docs it should also be possible to
access this directly.
[% fields %] - List of fields
[% field %] - Hash of fields (for lookup by name)
Lets say I have a field named
firstname then it should be possible to do:
[% form.fields.firstname.label %]
BUT NOTHING SHOWS UP.
If I know the array index I can acces the infor by:
[% form.field.3.label %] expecting 3 to be the index for 'firstname'
I have tried to create a testhash in the controller like:
my %testhash;
$testhash{firstname} = "myname";
$c->stash->{testhash} = \%testhash;
and I have no problem using:
[% testhash.firstname %]
in the .tt2 file
What am i missing or what have I overlooked??
Regards
Peter Sørensen/University of Southern Denmark/email: [EMAIL PROTECTED]
Med venlig hilsen
Peter Sørensen
Vid.medarb., IT-service
Tlf. 6550 2858
Fax 6550 2860
Email [EMAIL PROTECTED]
Web http://intern.sdu.dk/it-service/ansatte/ps-238/
Adr. Campusvej 55, 5230 Odense M
SYDDANSK UNIVERSITET
_______________________________________________________________
Campusvej 55 * 5230 * Odense M * Tlf. 6550 1000 * www.sdu.dk
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates