Hi David,

well that's a new one by me.. I wouldn't have expected the first one to work, but it looks like sort is returning the keys of the hash..

I think this should work for you..

[% FOREACH n = school_details %]
      <tr><td>[% n.key %]</td><td>[% n.value %]</td></tr>
[% END %]

and by the looks of things, that will sort them too..

http://www.template-toolkit.org/docs/plain/Manual/Directives.html#Loop_Processing

cheers,

J


D. Martin wrote:
Hi everyone,

This is my first post to the list. I am very new to TT2.

My problem is this, I am iterating over a hash and this:

[% FOREACH n = school_details.sort %]
<tr><td>[% n %]</td><td>[% school_details.$n %]</td></tr> [% END %]


works exactly as expected.

But take the sort out like so:

[% FOREACH n = school_details %]
<tr><td>[% n %]</td><td>[% school_details.$n %]</td></tr> [% END %]


And the output looks like this:

HASH(0x877d21c) HASH(0x877d1ec) HASH(0x877d1bc) HASH(0x877d1a4)

Presumably the address in Perl's symbol table.

What am I doing wrong?

TIA,

David Martin/ jerrygarciuh


All you have to do is decide what to do with the time that is given to you. ~ GTG




_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates




_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to