[Templates] sorting a multi-valued hash
Jonathan Mangin
jon.mangin@comcast.net
Thu, 24 Aug 2006 10:40:46 -0400
Hi,
Is it possible to sort a multi-valued hash?
In psuedo-code (all cols are text):
$menu{id} = [concat(col2,col3), col2, col3];
I hoped it would default to sorting on value.0, but output
appears random.
[% FOREACH item IN menu.sort %]
[% IF menu.$item.1 == rows.0.1 %]
<option value="[% item %]" selected>[% menu.$item.0 %]
[% ELSE %]
<option value="[% item %]">[% menu.$item.0 %]
[% END %]
[% END %]
Two (or more) of these constructs in the template sort in
the same order. It must not be random but I can't see the
pattern. Is there anything else I can do to get a sort on
value.0?
Thanks,
Jon