From 661d926936a21e768bbf60c8e528432949cb713d Mon Sep 17 00:00:00 2001 From: finlayt Date: Thu, 12 Sep 2002 04:22:35 +0000 Subject: [PATCH] added a gettemplate routine that does all the template intialisation and theme/lang stuff... --- C4/Output.pm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/C4/Output.pm b/C4/Output.pm index 902932660c..9aea6f1dfa 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -27,6 +27,7 @@ package C4::Output; use strict; require Exporter; +use HTML::Template; use C4::Database; use C4::Koha; @@ -43,7 +44,7 @@ $VERSION = 0.01; &mkform &mkform2 &bold &gotopage &mkformnotable &mkform3 &getkeytableselectoptions - &picktemplate &themelanguage + &picktemplate &themelanguage &gettemplate ); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], @@ -79,6 +80,26 @@ my $path=$configfile->{'includes'}; # make all your functions, whether exported or not; +sub gettemplate { + my ($tmplbase, $opac) = @_; + + my $htdocs; + if ($opac) { + $htdocs = $configfile->{'opachtdocs'}; + } else { + $htdocs = $configfile->{'intrahtdocs'}; + } + + my ($theme, $lang) = themelanguage($htdocs, $tmplbase); + + my $template = HTML::Template->new(filename => "$htdocs/$theme/$lang/$tmplbase", + die_on_bad_params => 0, + path => ["$htdocs/$theme/$lang/includes"]); + + $template->param(themelang => "/$theme/$lang"); + return $template; +} + sub picktemplate { my ($includes, $base) = @_; my $dbh=C4Connect; -- 2.39.5