Revision 25205ac9
Von Sven Schöling vor mehr als 2 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
}
|
||
$language = "de" unless ($language);
|
||
|
||
my $webpages_path = $::request->layout->webpages_path;
|
||
my $webpages_path = $::request->layout->webpages_path;
|
||
my $webpages_fallback = $::request->layout->webpages_fallback_path;
|
||
|
||
if (-f "${webpages_path}/${file}.html") {
|
||
$file = "${webpages_path}/${file}.html";
|
||
my @templates = first { -f } map { "${_}/${file}.html" } grep { defined } $webpages_path, $webpages_fallback;
|
||
|
||
if (@templates) {
|
||
$file = $templates[0];
|
||
} elsif (ref $file eq 'SCALAR') {
|
||
# file is a scalarref, use inline mode
|
||
} else {
|
SL/Layout/Base.pm | ||
---|---|---|
"templates/webpages";
|
||
}
|
||
|
||
sub webpages_fallback_path {
|
||
}
|
||
|
||
sub html_dialect {
|
||
'transitional'
|
||
}
|
||
... | ... | |
stylesheets where the templates are so incompatible that a complete fork of the
|
||
templates dir is sensible.
|
||
|
||
=item * webpages_fallback_path
|
||
|
||
Allows partial template sets to fallback to other paths in case a template
|
||
wasn't found. Intended to be used in conjunction with L</webpages_path>.
|
||
|
||
Note: in case a template can't be found at all, generic/error.html will be
|
||
rendered, and the fallback doesn't work in this case.
|
||
|
||
|
||
=item * allow_stylesheet_fallback
|
||
|
||
Defaults to true. The default behaviour is that stylesheets not found in the
|
SL/Presenter.pm | ||
---|---|---|
|
||
use Carp;
|
||
use Template;
|
||
use List::Util qw(first);
|
||
|
||
use SL::Presenter::EscapedText qw(is_escaped);
|
||
|
||
... | ... | |
# Look for the file given by $template if $template is not a reference.
|
||
my $source;
|
||
if (!ref $template) {
|
||
my $webpages_path = $::request->layout->webpages_path;
|
||
my $webpages_path = $::request->layout->webpages_path;
|
||
my $webpages_fallback = $::request->layout->webpages_fallback_path;
|
||
|
||
my $ext = $options->{type} eq 'text' ? 'txt' : $options->{type};
|
||
$source = "${webpages_path}/${template}.${ext}";
|
||
croak "Template file ${source} not found" unless -f $source;
|
||
|
||
$source = first { -f } map { "${_}/${template}.${ext}" } grep { defined } $webpages_path, $webpages_fallback;
|
||
|
||
croak "Template file ${template} not found" unless $source;
|
||
|
||
} elsif (ref($template) eq 'SCALAR') {
|
||
# Normal scalar reference: hand over to Template
|
||
... | ... | |
sub get_template {
|
||
my ($self) = @_;
|
||
|
||
my $webpages_path = $::request->layout->webpages_path;
|
||
my $webpages_path = $::request->layout->webpages_path;
|
||
my $webpages_fallback = $::request->layout->webpages_fallback_path;
|
||
|
||
my $include_path = join ':', grep defined, $webpages_path, $webpages_fallback;
|
||
|
||
# Make locales.pl parse generic/exception.html, too:
|
||
# $::form->parse_html_template("generic/exception")
|
||
... | ... | |
ABSOLUTE => 1,
|
||
CACHE_SIZE => 0,
|
||
PLUGIN_BASE => 'SL::Template::Plugin',
|
||
INCLUDE_PATH => ".:$webpages_path",
|
||
INCLUDE_PATH => ".:$include_path",
|
||
COMPILE_EXT => '.tcc',
|
||
COMPILE_DIR => $::lx_office_conf{paths}->{userspath} . '/templates-cache',
|
||
ERROR => "${webpages_path}/generic/exception.html",
|
Auch abrufbar als: Unified diff
Layout: webpages_fallback_path Mechanismus