Added ability to switch between two templates. One template shows
authortonnesen <tonnesen>
Fri, 10 May 2002 17:41:05 +0000 (17:41 +0000)
committertonnesen <tonnesen>
Fri, 10 May 2002 17:41:05 +0000 (17:41 +0000)
biblionumber, the other template shows notes, in the third column.

My thinking is that for every template, the scripts can search for a local
version of the template before using the default template.

html-template/cmsdsearchresults.tmpl [new file with mode: 0644]
html-template/search.pl
html-template/searchheader.tmpl [new file with mode: 0644]
html-template/searchresults.tmpl

diff --git a/html-template/cmsdsearchresults.tmpl b/html-template/cmsdsearchresults.tmpl
new file mode 100644 (file)
index 0000000..f7dd9e8
--- /dev/null
@@ -0,0 +1,18 @@
+<html>
+<head><title>Search Results</title>
+</head>
+<body>
+<TMPL_INCLUDE NAME="searchheader.tmpl">
+<table border=1>
+<tr><th>Title</th><th>Author</th><th>Notes</th></tr>
+<TMPL_LOOP NAME=SEARCH_RESULTS>
+  <tr>
+  <td> <TMPL_VAR NAME=title> </td>
+  <td> <TMPL_VAR NAME=author> </td>
+  <td> <TMPL_VAR NAME=notes> </td>
+  </tr>
+</TMPL_LOOP>
+</table>
+<hr>
+</body>
+</html>
index d728de4..7e811c0 100755 (executable)
@@ -3,12 +3,18 @@ use HTML::Template;
 use strict;
 require Exporter;
 use C4::Database;
+use CGI;
+my $query=new CGI;
+
+my $template=$query->param('template');
+($template) || ($template='searchresults.tmpl');
 
 
 my $dbh=&C4Connect;  
 
 
-my $template = HTML::Template->new(filename => 'searchresults.tmpl', die_on_bad_params => 0);
+my $template = HTML::Template->new(filename => $template, die_on_bad_params => 0);
 
 my @results;
 my $sth=$dbh->prepare("select * from biblio where author like 's%' limit 20");
diff --git a/html-template/searchheader.tmpl b/html-template/searchheader.tmpl
new file mode 100644 (file)
index 0000000..c2dc399
--- /dev/null
@@ -0,0 +1,2 @@
+<a href=search.pl?template=cmsdsearchresults.tmpl>Template #1</a> | <a href=search.pl?template=searchresults.tmpl>Template #2</a>
+<hr>
index acd8a5f..4a97e4a 100644 (file)
@@ -1,7 +1,8 @@
 <html>
-<head><title>Test Template</title>
+<head><title>Search Results</title>
 </head>
 <body>
+<TMPL_INCLUDE NAME="searchheader.tmpl">
 <table border=1>
 <tr><th>Title</th><th>Author</th><th>Biblionumber</th></tr>
 <TMPL_LOOP NAME=SEARCH_RESULTS>