[Templates] Sorting a hash by value

Jonathan Mangin jon.mangin@comcast.net
Thu, 31 May 2007 10:46:53 -0400


Hi,

I have a simple hash with numeric id as key and
alphabetic name as value.  In my template:

[% FOREACH key IN items.keys %]
   [% IF key == rows.0.1 %]
      <option value=[% key %] selected>[% items.$key %]
   [% ELSE %]
      <option value=[% key %]>[% items.$key %]
   [% END %]
[% END %]

%items is populating up to 20 drop-downs and I'd like to
sort on value.  Is there a way to do that?

Thanks,
Jon