[Catalyst] generic db table list
Fernan Aguero
fernan at iib.unsam.edu.ar
Fri Jun 2 16:10:29 CEST 2006
+----[ Cory Watson <jheephat at gmail.com> (02.Jun.2006 09:54):
|
| On 6/2/06, Fernan Aguero <fernan at iib.unsam.edu.ar> wrote:
| <snip>
| >This is not working for me ... maybe I'm wrongly guessing
| >that rs.next() returns a hash?
| >
| >The following doesn't print anything:
| >
| >[% FOREACH row in rs.next() %]
| >[% FOREACH column in row.keys %]
| > [% column %] [% row.$column %]
| >[% END %]
| >[% END %]
|
| ResultSet's next method returns objects.
OK, got it now.
| To get the columns you would want to do this:
|
| [% FOREACH row in rs.next %]
| [% FOREACH column in row.columns %]
| [% column %]: [% row.$column %]
| [% END %]
| [% END %]
Which sounds pretty much like what Aran suggested.
I like Aran's example because it's more verbose:
[% FOREACH column IN row.result_source.columns %]
<td>[% row.get_column(column) %]</td>
And I like your example, because it's more compact and
easier to type :)
| --
| Cory 'G' Watson
|
+----]
Thanks,
Fernan
More information about the Catalyst
mailing list