Starting to play with HTML::Template
I'm going to work on the search interface instead of the circulation interface as the search interface is where my librarians want the most changes at the moment.
This commit is contained in:
parent
27d0900c6d
commit
5c41d379cf
|
|
@ -0,0 +1,17 @@
|
|||
#!/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' }
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
print "Content-Type: text/html\n\n", $template->output;
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<html>
|
||||
<head><title>Test Template</title>
|
||||
</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>
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue