naming keys in the <tmpl_loop>
Robert Franks <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Message-ID | <[email protected]> |
I am new to the HTML::Template module, as you will see:
I have successfully generated the <tmpl_loop> using an array
which contains a hash reference.
However, in the html page I want to be able to loop through my hash
without knowing the names of the keys.
What is the best way to do this?
eg. in my cgi script I have:
my %price_hash = (
"key1" => "val1",
"key2" => "val2",
"key3" => "val3",
"key89" => "val89"
);
push (@price_array, \%price_hash);
$param->{"price_loop"} = \@price_array;
So that in the html page I can use:
<tmpl_loop name="price_loop">
....
</tmpl_loop>
I know I can use
<tmpl_var name="key89">
in the loop, but to output "val89" that relies on me knowing that
key89 exists, and its name..
How can I just loop through the hash printing out the keys and
values, without knowing the keys?
--
Robert Franks
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Html-template-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/html-template-users