--- trunk/WebPac.pm 2003/10/30 00:10:09 140 +++ trunk/WebPac.pm 2003/11/16 16:14:37 147 @@ -27,6 +27,7 @@ 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 @@ -49,6 +50,19 @@ $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",); + 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; @@ -60,8 +74,8 @@ 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 { @@ -214,7 +228,7 @@ my $html = $pager->output; - return $html; + return in_template($html); } sub show_index { @@ -272,7 +286,7 @@ template => $tmpl, ); - return $pager->output; + return in_template($pager->output); } 1;