Still playing. Added a "next record" link
authortonnesen <tonnesen>
Fri, 10 May 2002 21:22:18 +0000 (21:22 +0000)
committertonnesen <tonnesen>
Fri, 10 May 2002 21:22:18 +0000 (21:22 +0000)
html-template/cmsdsearchresults.tmpl
html-template/search.pl
html-template/searchresults.tmpl

index f7dd9e8..3ffb0f5 100644 (file)
@@ -12,6 +12,7 @@
   <td> <TMPL_VAR NAME=notes> </td>
   </tr>
 </TMPL_LOOP>
+<tr><td colspan=3><a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="startfrom">>Next Records</a></td></tr>
 </table>
 <hr>
 </body>
index 7e811c0..0fb0672 100755 (executable)
@@ -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;
index 4a97e4a..3db4a47 100644 (file)
@@ -12,6 +12,7 @@
   <td> <TMPL_VAR NAME=biblionumber> </td>
   </tr>
 </TMPL_LOOP>
+<tr><td colspan=3><a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="startfrom">>Next Records</a></td></tr>
 </table>
 <hr>
 </body>