my $MAX_HITS = $cfg_global->val('webpac', 'max_hits') || 0;
my $ON_PAGE =$cfg_global->val('webpac', 'on_page') || 10;
my $MIN_WILDCARD =$cfg_global->val('webpac', 'min_wildcard') || 1;
+my $TEMPLATE =$cfg_global->val('webpac', 'template');
Text::Iconv->raise_error(0); # Conversion errors raise exceptions
$self->header_props(-charset=>$CHARSET);
}
+sub in_template {
+ my $html = shift || "This page is left unintentionally blank";
+ return $html if (! defined($TEMPLATE));
+ if (open(T, $TEMPLATE)) {
+ my $template_html = join("\n",<T>);
+ close(T);
+ $template_html =~ s/##webpac##/$html/gsi;
+ return $template_html;
+ } else {
+ return "Can't read template '$TEMPLATE'";
+ }
+}
+
sub show_search_form {
my $self = shift;
my $fif = new HTML::FillInForm;
- return $fif->fill(scalarref => \$html, fobject => $q,
- target => 'search');
+ return in_template($fif->fill(scalarref => \$html, fobject => $q,
+ target => 'search'));
}
sub show_results_list {
my $html = $pager->output;
- return $html;
+ return in_template($html);
}
sub show_index {
template => $tmpl,
);
- return $pager->output;
+ return in_template($pager->output);
}
1;