Hi, I'd really appreciate some help here.
i am considering modify a cool page or what is new page. basically i want links listed on the page been printed
through the way of loop of i could use tag <%even%>
here is the orignal code
sub main
{ #--------------------------------------------------- #
if (!$USER)
{
my $url = $IN->escape ($IN->url ( absolute => 1, query_string => 1 ));
print $IN->redirect ( $CFG->{db_cgi_url} . "/user.cgi?url=$url" );
return;
}
else
{
featured();
}
}
# you are now logged in and user info is in $USER.
sub featured {
#---------------------------------------------------
#
my $pageNum = $IN->param('nh') || 1;
my $linksPP = 5;
my $start = $linksPP * $pageNum - $linksPP;
$start = ($pageNum < 2) ? 0 : $start;
my ($sth,$tab,$output);
$tab = $DB->table('Links');
$tab->select_options('ORDER BY Title', 'LIMIT ' . $linksPP . ' OFFSET ' . $start);
$sth = $tab->select( { isValidated => 'Yes' } );
my $hits = $tab->hits;
while (my $rec = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $rec);
}
my $tags;
$tags->{'paging'}->{'url'} = $CFG->{db_cgi_url} . "/admin/linktest/featured.cgi";
$tags->{'paging'}->{'num_hits'} = $hits;
$tags->{'paging'}->{'max_hits'} = $linksPP;
$tags->{'paging'}->{'current_page'} = $pageNum;
$tags->{'output'} = $output;
print $IN->header();
print Links::SiteHTML::display('detail', $tags);
}
1;
i am considering modify a cool page or what is new page. basically i want links listed on the page been printed
through the way of loop of i could use tag <%even%>
here is the orignal code
sub main
{ #--------------------------------------------------- #
if (!$USER)
{
my $url = $IN->escape ($IN->url ( absolute => 1, query_string => 1 ));
print $IN->redirect ( $CFG->{db_cgi_url} . "/user.cgi?url=$url" );
return;
}
else
{
featured();
}
}
# you are now logged in and user info is in $USER.
sub featured {
#---------------------------------------------------
#
my $pageNum = $IN->param('nh') || 1;
my $linksPP = 5;
my $start = $linksPP * $pageNum - $linksPP;
$start = ($pageNum < 2) ? 0 : $start;
my ($sth,$tab,$output);
$tab = $DB->table('Links');
$tab->select_options('ORDER BY Title', 'LIMIT ' . $linksPP . ' OFFSET ' . $start);
$sth = $tab->select( { isValidated => 'Yes' } );
my $hits = $tab->hits;
while (my $rec = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $rec);
}
my $tags;
$tags->{'paging'}->{'url'} = $CFG->{db_cgi_url} . "/admin/linktest/featured.cgi";
$tags->{'paging'}->{'num_hits'} = $hits;
$tags->{'paging'}->{'max_hits'} = $linksPP;
$tags->{'paging'}->{'current_page'} = $pageNum;
$tags->{'output'} = $output;
print $IN->header();
print Links::SiteHTML::display('detail', $tags);
}
1;