Revision eb24ae59
Von Sven Schöling vor mehr als 2 Jahren hinzugefügt
SL/Presenter.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use Carp; |
8 | 8 |
use Template; |
9 |
use List::Util qw(first); |
|
9 | 10 |
|
10 | 11 |
use SL::Presenter::EscapedText qw(is_escaped); |
11 | 12 |
|
... | ... | |
45 | 46 |
# Look for the file given by $template if $template is not a reference. |
46 | 47 |
my $source; |
47 | 48 |
if (!ref $template) { |
48 |
my $webpages_path = $::request->layout->webpages_path; |
|
49 |
my $webpages_path = $::request->layout->webpages_path; |
|
50 |
my $webpages_fallback = $::request->layout->webpages_fallback_path; |
|
49 | 51 |
|
50 | 52 |
my $ext = $options->{type} eq 'text' ? 'txt' : $options->{type}; |
51 |
$source = "${webpages_path}/${template}.${ext}"; |
|
52 |
croak "Template file ${source} not found" unless -f $source; |
|
53 |
|
|
54 |
$source = first { -f } map { "${_}/${template}.${ext}" } grep { defined } $webpages_path, $webpages_fallback; |
|
55 |
|
|
56 |
croak "Template file ${template} not found" unless $source; |
|
53 | 57 |
|
54 | 58 |
} elsif (ref($template) eq 'SCALAR') { |
55 | 59 |
# Normal scalar reference: hand over to Template |
... | ... | |
98 | 102 |
sub get_template { |
99 | 103 |
my ($self) = @_; |
100 | 104 |
|
101 |
my $webpages_path = $::request->layout->webpages_path; |
|
105 |
my $webpages_path = $::request->layout->webpages_path; |
|
106 |
my $webpages_fallback = $::request->layout->webpages_fallback_path; |
|
107 |
|
|
108 |
my $include_path = join ':', grep defined, $webpages_path, $webpages_fallback; |
|
102 | 109 |
|
103 | 110 |
# Make locales.pl parse generic/exception.html, too: |
104 | 111 |
# $::form->parse_html_template("generic/exception") |
... | ... | |
108 | 115 |
ABSOLUTE => 1, |
109 | 116 |
CACHE_SIZE => 0, |
110 | 117 |
PLUGIN_BASE => 'SL::Template::Plugin', |
111 |
INCLUDE_PATH => ".:$webpages_path",
|
|
118 |
INCLUDE_PATH => ".:$include_path",
|
|
112 | 119 |
COMPILE_EXT => '.tcc', |
113 | 120 |
COMPILE_DIR => $::lx_office_conf{paths}->{userspath} . '/templates-cache', |
114 | 121 |
ERROR => "${webpages_path}/generic/exception.html", |
Auch abrufbar als: Unified diff
Layout: webpages_fallback_path Mechanismus