2010-11-15 63 views

Répondre

2

J'utilise le modèle :: fournisseur pour cette

my $template_config = { 
     INCLUDE_PATH => "/path/to/templates", 
     ENCODING => 'utf8', 
}; 



# Create template_provider manually so that we can manipulate template path 
# later. 
my $template_provider = Template::Provider->new($template_config); 

    my $tt = Template->new({ 
     LOAD_TEMPLATES => [$template_provider ], 
     PRE_CHOMP => 2, 
     POST_CHOMP => 3, 
     TRIM   => 1, 
     ENCODING  => 'utf8', 
    }) || die $Template::ERROR; 


# somewhere else later 
     $template_provider->include_path([ 
     "$dir/templates/$language", 
     "$dir/templates"]);