in reply to How to create a table with rows and columns using HTML::Template loops?
And, the perl part:<table> <thead> <tr> <!-- tmpl_loop name="fields" --> <th><!-- tmpl_var name="field" --></th> <!-- /tmpl_loop --> </tr> </thead> <tbody> <!-- tmpl_loop name="data" --> <tr> <!-- tmpl_loop name="cols" --> <td><!-- tmpl_var name="value" --></td> <!-- /tmpl_loop --> </tr> <!-- /tmpl_loop --> </tbody> </table>
Hope this helps.my @fields = qw(your columns names here); $object->get_all(%params); while (my $obj = $object->get_next){ my @row = map {{value => $obj->$_}} @fields; push @data, {cols => \@row}; } $template->param(fields => \@fields); $template->param(data => \@data);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to create a table with rows and columns using HTML::Template loops?
by BlenderHead (Novice) on Jun 24, 2009 at 04:14 UTC |