[Koha-cvs] CVS: koha/html-template search.pl,1.1,1.2 searchresults.tmpl,1.2,1.3

Steve Tonnesen tonnesen at users.sourceforge.net
Fri May 10 19:21:38 CEST 2002


Update of /cvsroot/koha/koha/html-template
In directory usw-pr-cvs1:/tmp/cvs-serv16194

Modified Files:
	search.pl searchresults.tmpl 
Log Message:
Now using real data.  Returns first 20 records where author starts with 's'


Index: search.pl
===================================================================
RCS file: /cvsroot/koha/koha/html-template/search.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** search.pl	10 May 2002 17:08:04 -0000	1.1
--- search.pl	10 May 2002 17:21:36 -0000	1.2
***************
*** 1,15 ****
  #!/usr/bin/perl -w
  use HTML::Template;
  
  my $template = HTML::Template->new(filename => 'searchresults.tmpl', die_on_bad_params => 0);
  
! $template->param(PET => 'Allie');
! $template->param(NAME => 'Steve Tonnesen');
  
  
! $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' }
! 				     ]
  		);
  
--- 1,25 ----
  #!/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);
  
! 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 => \@results
  		);
  

Index: searchresults.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/html-template/searchresults.tmpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** searchresults.tmpl	10 May 2002 17:12:31 -0000	1.2
--- searchresults.tmpl	10 May 2002 17:21:36 -0000	1.3
***************
*** 3,19 ****
  </head>
  <body>
- Testing <TMPL_VAR NAME=NAME>
- <p>
- Pet's Name: <TMPL_VAR NAME=PET>
- <p>
- <hr>
  <table border=1>
! <tr><th>Barcode</th><th>Title</th><th>Author</th><th>Dewey</th></tr>
  <TMPL_LOOP NAME=SEARCH_RESULTS>
    <tr>
!   <td> <TMPL_VAR NAME=BARCODE> </td>
!   <td> <TMPL_VAR NAME=TITLE> </td>
!   <td> <TMPL_VAR NAME=AUTHOR> </td>
!   <td> <TMPL_VAR NAME=DEWEY> </td>
    </tr>
  </TMPL_LOOP>
--- 3,13 ----
  </head>
  <body>
  <table border=1>
! <tr><th>Title</th><th>Author</th><th>Biblionumber</th></tr>
  <TMPL_LOOP NAME=SEARCH_RESULTS>
    <tr>
!   <td> <TMPL_VAR NAME=title> </td>
!   <td> <TMPL_VAR NAME=author> </td>
!   <td> <TMPL_VAR NAME=biblionumber> </td>
    </tr>
  </TMPL_LOOP>





More information about the Koha-cvs mailing list