Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 567c0d7c

Von Sven Schöling vor mehr als 14 Jahren hinzugefügt

  • ID 567c0d7c4b7dec742d398ea6df68fc34a0c2649c
  • Vorgänger 7ee0b1dc
  • Nachfolger 7dd8ee36

Template Objekt cachen.

Unterschiede anzeigen:

SL/Form.pm
847 847

  
848 848
  $additional_params ||= { };
849 849

  
850
  $file = $self->_prepare_html_template($file, $additional_params);
851

  
852
  my $template = Template->new({ 'INTERPOLATE'  => 0,
853
                                 'EVAL_PERL'    => 0,
854
                                 'ABSOLUTE'     => 1,
855
                                 'CACHE_SIZE'   => 0,
856
                                 'PLUGIN_BASE'  => 'SL::Template::Plugin',
857
                                 'INCLUDE_PATH' => '.:templates/webpages',
858
                                 'COMPILE_EXT'  => $main::template_compile_ext,
859
                                 'COMPILE_DIR'  => $main::template_compile_dir,
860
                               }) || die;
850
  my $real_file = $self->_prepare_html_template($file, $additional_params);
851
  my $template  = $self->template || $self->init_template;
861 852

  
862 853
  map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self };
863 854

  
864 855
  my $output;
865
  $template->process($file, $additional_params, \$output) || die $template->error();
856
  $template->process($real_file, $additional_params, \$output) || die $template->error;
866 857

  
867 858
  $main::lxdebug->leave_sub();
868 859

  
869 860
  return $output;
870 861
}
871 862

  
863
sub init_template {
864
  my $self = shift;
865

  
866
  return if $self->template;
867

  
868
  return $self->template(Template->new({
869
     'INTERPOLATE'  => 0,
870
     'EVAL_PERL'    => 0,
871
     'ABSOLUTE'     => 1,
872
     'CACHE_SIZE'   => 0,
873
     'PLUGIN_BASE'  => 'SL::Template::Plugin',
874
     'INCLUDE_PATH' => '.:templates/webpages',
875
     'COMPILE_EXT'  => $main::template_compile_ext,
876
     'COMPILE_DIR'  => $main::template_compile_dir,
877
  })) || die;
878
}
879

  
880
sub template {
881
  my $self = shift;
882
  $self->{template_object} = shift if @_;
883
  return $self->{template_object};
884
}
885

  
872 886
sub show_generic_error {
873 887
  $main::lxdebug->enter_sub();
874 888

  

Auch abrufbar als: Unified diff