On Fri, 19 Sep 2003, Simon Wilcox wrote:
> On Fri, 19 Sep 2003, Mace, Richard wrote:
>
> > Hi,
> > I have a hash in my CGI script, e.g. $info{$filename} = $filepath;
> > (hash contents e.g.
> > KEY: one.html, VALUE: /REPORTS
> > KEY: two.html, VALUE: /REPORTS
> >
> > [% FOREACH project = info %]
> > <A HREF="[% project.value %]/[% project.key %]">[% project.key %]
> > [% END %]
>
> You might try the 'sort' vmethod. From Template::Manual::VMethods :
But in that case three would come before two.
Use an array of hashes and your template code won't have to change:
@info = ( { 'one.html' => '/REPORTS' },
{ 'two.html' => '/REPORTS' }
);
[% FOREACH project = info %]
<A HREF="[% project.value %]/[% project.key %]">[% project.key %]
[% END %]
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates