Hello everyone,
I'm trying to use DBIx::Class with HTML::Template and I can't seem to
get it to work.
Here's how I'm calling DBIC and HTML::Template in my script:
my $tmpl = HTML::Template->new( filename => "single_stories.tmpl",
die_on_bad_params => 1);
my @stories = $schema->resultset('Stories')->search( { user_id => 1234 } )->all;
if ( $stories ) {
$tmpl->param( stories => $stories );
print $tmpl->output;
}
Here's my single_stories.tmpl:
<TMPL_IF NAME="stories">
<TMPL_LOOP NAME="stories">
<TMPL_VAR NAME="story_id">
</TMPL_LOOP>
</TMPL_IF>
If I do this with my script, I'm able to get the data passed correctly
to HTML::Template:
if ($stories) {
my @sts;
while ( my $st = $stories->next ) {
push @sts, { story_id => $st->story_id };
}
$tmpl->param( stories => [EMAIL PROTECTED] );
print $tmpl->output;
}
Basically, I make an array of anonymous hashes with the data in it.
Anyway to do this with DBIC without having to cycle build the AoH?
Thanks for any help,
Kevin
--
Kevin Old
[EMAIL PROTECTED]
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/