Re: loop through a hash structure without knowing the hash keys?
Mathew Robertson <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Organization | Nielsen//NetRatings |
| Message-ID | <[email protected]> |
It sounds like you need a tool which simply dumps the template variable names (ie: using the $ht->params() function), rather than some special mode to H::T Mathew Boon Chew wrote: > Ya sorry, that's what I meant. > > Right now I am working on some site code, and the designer sometimes > have to come to me for stuff because he doesn't always know what hash > keys I am passing to him (say sometimes I might add a new one, > sometimes he mistype one, etc.). The whole point of doing this > template separation is to decouple things, but if the designer can > only figure out what's being passed into the template by looking at > the module code, it kinda defeats the whole purpose. > > It would be such great convenience to be able to dump the whole thing > on the HTML with a call like this: > > <tmpl_var story_loop> > > or > > <tmpl_loop story_loop> > <column_var> <-- outputs all keys here > </tmpl_loop> > > */Carl Franks <[email protected]>/* wrote: > > > e.g. > > > > > > > > a TMPL_LOOP doesn't take a hash, it takes an array-ref of hash-refs > that would be > > my @loop = ( > {name => 'a'}, > {name => 'b'}, > ); > > $tmpl->param( students => \@loop ); > > If you knew that already, give an example of what sort of data you > want to put in, and what you want the HTML to look like. > > Cheers, > Carl > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id865&op=click > _______________________________________________ > Html-template-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > ------------------------------------------------------------------------ > *Yahoo! Personals* > Single? There's someone we'd like you to meet. > Lots of someones, actually. Yahoo! Personals > <http://us.rd.yahoo.com/evt=36108/*http://personals.yahoo.com%20>