logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: (no subject): msg#00059

Subject: Re: (no subject)
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 %]



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>