From 0f6b4029fc59428419a915c6869dd262c4736988 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Fri, 10 May 2002 17:21:36 +0000 Subject: [PATCH] Now using real data. Returns first 20 records where author starts with 's' --- html-template/search.pl | 22 ++++++++++++++++------ html-template/searchresults.tmpl | 14 ++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/html-template/search.pl b/html-template/search.pl index 91e4ed5932..d728de4eb9 100755 --- a/html-template/search.pl +++ b/html-template/search.pl @@ -1,16 +1,26 @@ #!/usr/bin/perl -w use HTML::Template; +use strict; +require Exporter; +use C4::Database; + + +my $dbh=&C4Connect; + my $template = HTML::Template->new(filename => 'searchresults.tmpl', die_on_bad_params => 0); -$template->param(PET => 'Allie'); -$template->param(NAME => 'Steve Tonnesen'); +my @results; +my $sth=$dbh->prepare("select * from biblio where author like 's%' limit 20"); +$sth->execute; +while (my $data=$sth->fetchrow_hashref){ + push @results, $data; +} + + -$template->param(SEARCH_RESULTS => [ { barcode => '123456789', title => 'Me and My Dog', author => 'Jack London', dewey => '452.32' }, - { barcode => '153253216', title => 'Dogs in Canada', author => 'Jack London', dewey => '512.3' }, - { barcode => '163214576', title => 'Howling at the Moon', author => 'Jack London', dewey => '476' } - ] +$template->param(SEARCH_RESULTS => \@results ); diff --git a/html-template/searchresults.tmpl b/html-template/searchresults.tmpl index 56ab863b64..acd8a5ff05 100644 --- a/html-template/searchresults.tmpl +++ b/html-template/searchresults.tmpl @@ -2,19 +2,13 @@ Test Template -Testing -

-Pet's Name: -

-


- + - - - - + + +
BarcodeTitleAuthorDewey
TitleAuthorBiblionumber
-- 2.39.5