sub main {
my $self = shift;
my $tmpl = $self->load_tmpl(
'index.html',
%config_vars
);
my $q = $self->query;
my $comments = $schema->resultset('News')->search(
undef,
{
rows => 10,
page => $q->param('next_page'),
order_by => 'date DESC'
}
);
## let's populate @comments
for ( $comments->all ) {
my %row_data;
#$row_data{'comment_id'} = $_->comment_id;
$row_data{'post_subject'} = $_->subject;
$row_data{'post_author'} = $_->author;
$row_data{'post_date'} = $_->date;
$row_data{'post_id'} = $_->postid;
$row_data{'post_content'} = $_->story;
#$row_data{'is_hidden'} = $_->is_hidden;
# push it into the the loop....
push ( @end_posts, \%row_data );
}
$tmpl->param(
site_title => $self->param('main_page_title'),
site_css => 'css/main.css',
post_data => \@end_posts,
next_page => $comments->pager->next_page,
previous_page => $comments->pager->previous_page,
);
$tmpl->output;
}
####
my $comments = $schema->resultset('News')->search(
undef,
{
rows => 10,
page => $q->param('next_page'),
order_by => 'date DESC'
}
);
####
my $comments = $schema->resultset('News')->search(
{},
{
rows => 10,
page => $q->param('next_page'),
order_by => 'date DESC'
}
);