Added ability to switch between two templates. One template shows
[koha.git] / html-template / search.pl
1 #!/usr/bin/perl -w
2 use HTML::Template;
3 use strict;
4 require Exporter;
5 use C4::Database;
6 use CGI;
7  
8 my $query=new CGI;
9
10 my $template=$query->param('template');
11 ($template) || ($template='searchresults.tmpl');
12
13
14 my $dbh=&C4Connect;  
15
16
17 my $template = HTML::Template->new(filename => $template, die_on_bad_params => 0);
18
19 my @results;
20 my $sth=$dbh->prepare("select * from biblio where author like 's%' limit 20");
21 $sth->execute;
22 while (my $data=$sth->fetchrow_hashref){    
23     push @results, $data;
24 }
25
26
27
28
29 $template->param(SEARCH_RESULTS => \@results
30                 );
31
32
33 print "Content-Type: text/html\n\n", $template->output;