Re: [Templates] Assigning to a list

[prev] [thread] [next] [Date index for 2005/04/28]

From: Bart Simpson
Subject: Re: [Templates] Assigning to a list
Date: 17:42 on 28 Apr 2005
--- Josh Rosenbaum <josh@xxxxxxxxx.xxx> wrote:
> Maybe this will do what you want:
> 
>
http://www.template-toolkit.org/docs/plain/Manual/Directives.html#Loop_Processing
> 
>     [% users = {
> 	 tom   => 'Thomas',
> 	 dick  => 'Richard',
>          larry => 'Lawrence',
>        }
>     %]
> 
>     [% FOREACH u IN users %]
>        * [% u.key %] : [% u.value %]
>     [% END %]
> 
> -- Josh
> 

Thanks. I saw that. not what i want. Its just a one
element hash. I need the key and value separated with
descriptive names ( that i already use in the rest of
the template ) . I just did this:

[% ary = hashref.each;
   field  = ary.0;
   cols   = ary.1;
   ...
%]

thanks


> Bart Simpson wrote:
> > Can you assign to a list in a template? I tried
> > everyway i can imagine. I want to get the key and
> > value from the each function.
> > 
> > I tried :
> > 
> > [k v ] = hashref.each;
> > (k v)  = hashref.each;
> > (k , v)= hashref.each;
> > k, v = hashref.each;
> > 
> > thanks
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> > 
> > _______________________________________________
> > templates mailing list
> > templates@xxxxxxxxxxxxxxxx.xxx
> >
>
http://lists.template-toolkit.org/mailman/listinfo/templates
> 
> 
> _______________________________________________
> templates mailing list
> templates@xxxxxxxxxxxxxxxx.xxx
>
http://lists.template-toolkit.org/mailman/listinfo/templates
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Assigning to a list
Bart Simpson 17:12 on 28 Apr 2005

Re: [Templates] Assigning to a list
Josh Rosenbaum 17:31 on 28 Apr 2005

Re: [Templates] Assigning to a list
Bart Simpson 17:42 on 28 Apr 2005

Generated at 10:28 on 04 May 2005 by mariachi v0.52