From f257b8ae0eb8a0647536cd571571e60470c240bf Mon Sep 17 00:00:00 2001 From: tonnesen Date: Fri, 10 May 2002 21:22:18 +0000 Subject: [PATCH] Still playing. Added a "next record" link --- html-template/cmsdsearchresults.tmpl | 1 + html-template/search.pl | 19 +++++++++++-------- html-template/searchresults.tmpl | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/html-template/cmsdsearchresults.tmpl b/html-template/cmsdsearchresults.tmpl index f7dd9e89b0..3ffb0f5145 100644 --- a/html-template/cmsdsearchresults.tmpl +++ b/html-template/cmsdsearchresults.tmpl @@ -12,6 +12,7 @@ +&startfrom=>Next Records
diff --git a/html-template/search.pl b/html-template/search.pl index 7e811c0c2b..0fb067253b 100755 --- a/html-template/search.pl +++ b/html-template/search.pl @@ -7,17 +7,20 @@ use CGI; my $query=new CGI; -my $template=$query->param('template'); -($template) || ($template='searchresults.tmpl'); +my $templatename=$query->param('template'); +my $startfrom=$query->param('startfrom'); +($startfrom) || ($startfrom=0); +($templatename) || ($templatename='searchresults.tmpl'); my $dbh=&C4Connect; -my $template = HTML::Template->new(filename => $template, die_on_bad_params => 0); +print STDERR "SF: $startfrom\n"; +my $template = HTML::Template->new(filename => $templatename, die_on_bad_params => 0); my @results; -my $sth=$dbh->prepare("select * from biblio where author like 's%' limit 20"); +my $sth=$dbh->prepare("select * from biblio where author like 's%' order by author limit $startfrom,20"); $sth->execute; while (my $data=$sth->fetchrow_hashref){ push @results, $data; @@ -25,9 +28,9 @@ while (my $data=$sth->fetchrow_hashref){ - -$template->param(SEARCH_RESULTS => \@results - ); - +$startfrom+=20; +$template->param(startfrom => $startfrom); +$template->param(template => $templatename); +$template->param(SEARCH_RESULTS => \@results); print "Content-Type: text/html\n\n", $template->output; diff --git a/html-template/searchresults.tmpl b/html-template/searchresults.tmpl index 4a97e4ae4e..3db4a47d90 100644 --- a/html-template/searchresults.tmpl +++ b/html-template/searchresults.tmpl @@ -12,6 +12,7 @@ +&startfrom=>Next Records
-- 2.39.5