> -----Original Message-----
> From: JustSome person [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2003 3:09 PM
> Subject: [Templates] hashes w/in hashes: how to access
> I'm having a devil of a time trying to access/print
> write the values of the hashes. I've tried keys,
> $keys, values etc..and I can't get it to work...how
> would I access these vars:
>
> Cars
> $VAR!= {
> "buick" => {
> 'automatic' =>{
> 'silver'=>{}
> 'tan'=>{}
> }
> 'nonatutomatic'=>{
> 'burgundy'=>{}
> }
> }
> }
>
> so, the idea is to reiterate with a FOREACH thru cars,
> grab the cars..then their transmission, then colors.
> I can only print out the cars. Can't get any deeper
> than that.
Here is a example this works exactly the same if you move
the hash assignment to perl and not it the template. (well,
you'll have to change the vehicle= to vehicle=> but you
got that already... :)
[% vehicle= {
buick=> {
auto=> { silver=>{}, tan=>{}, },
non=> { burg=>{}, },
},
toyota=> {
auto=> { blue=>{}, red=>{}, },
non=> { green=>{}, blue=>{}, yellow=>{}, },
},
} %]
[% FOREACH v = vehicle %]
* [% v.key +%]
[% FOREACH tran = v.value %]
* [% tran.key +%]
[% FOREACH col = tran.value %]
* [% col.key %] : [% col.value +%]
[% END %]
[% END %]
[% END %]
I hope that helps!
--mark mills
Xodiax Engineering
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates