[Catalyst] generic db table list

Aran Deltac aran at arandeltac.com
Fri Jun 2 04:52:59 CEST 2006


On 6/1/06, Aran Deltac <aran at arandeltac.com> wrote:
> On 6/1/06, Fernan Aguero <fernan at iib.unsam.edu.ar> wrote:
[snip]
> > and it works, but this is just because I'm using the column
> > names for this particular case ... or saying it another way,
> > I've not found a way for looping through all the keys of a
> > hash in TT, like you can do with raw perl:
> > foreach $key ( keys(%hash) )
>
> Go to the docs for template toolkit and search for the string "The
> FOREACH directive can also be used to iterate through the entries in a
> hash array.".

On second thought, this is more likely what you are looking for is this:

[% FOREACH key IN hash.keys %]
       * [% key %]
[% END %]

This is documented in the TT VMethods Manual.

Aran

> Aran
>
> > All the examples in the Template Toolkit pods always use the
> > exact names of the keys for accessing values ... and I find
> > it difficult to follow the InstantCRUD example as the 'list'
> > action (InstantCRUD.pm, line 211) does not define any
> > 'columns' in the stash, but they are used in the associated
> > 'list.tt' template (where does this array come from?)
> >
> > For those familiar with InstantCRUD, there are some column
> > names begin pushed into the stash in another action (auto)
> > ... but I cannot see how they're connected.
> >
> > Thanks in advance for any help, suggestion or clarification,
> >
> > Fernan
> >
> >
> >
> > _______________________________________________
> > Catalyst mailing list
> > Catalyst at lists.rawmode.org
> > http://lists.rawmode.org/mailman/listinfo/catalyst
> >
>



More information about the Catalyst mailing list