Template Caching
authorSven Schöling <s.schoeling@linet-services.de>
Wed, 27 Jan 2010 14:03:27 +0000 (15:03 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Tue, 20 Jul 2010 09:21:31 +0000 (11:21 +0200)
SL/Form.pm
config/lx-erp.conf

index b0e25d7..468f6dc 100644 (file)
@@ -841,23 +841,14 @@ sub parse_html_template {
                                  'CACHE_SIZE'   => 0,
                                  'PLUGIN_BASE'  => 'SL::Template::Plugin',
                                  'INCLUDE_PATH' => '.:templates/webpages',
+                                 'COMPILE_EXT'  => $main::template_compile_ext,
+                                 'COMPILE_DIR'  => $main::template_compile_dir,
                                }) || die;
 
   map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self };
 
-  my $in = IO::File->new($file, 'r');
-
-  if (!$in) {
-    print STDERR "Error opening template file: $!";
-    $main::lxdebug->leave_sub();
-    return '';
-  }
-
-  my $input = join('', <$in>);
-  $in->close();
-
   my $output;
-  if (!$template->process(\$input, $additional_params, \$output)) {
+  if (!$template->process($file, $additional_params, \$output)) {
     print STDERR $template->error();
   }
 
index 810c723..38c4f57 100644 (file)
@@ -13,6 +13,10 @@ $spool = "spool";
 # templates base directory
 $templates = "templates";
 
+# template toolkit caching options
+$template_compile_ext = '.tcc';
+$template_compile_dir = 'templates/cache';
+
 # member file
 $memberfile = "users/members";