Revision c0f198fa
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/Controller/Base.pm | ||
---|---|---|
37 | 37 |
print $::cgi->redirect($url); |
38 | 38 |
} |
39 | 39 |
|
40 |
sub render { |
|
41 |
my $self = shift; |
|
42 |
|
|
43 |
my $template; |
|
44 |
$template = shift if scalar(@_) % 2; |
|
45 |
my %params = @_; |
|
46 |
|
|
47 |
if ($params{title}) { |
|
48 |
$::form->{title} = delete $params{title}; |
|
49 |
$::form->header; |
|
50 |
} |
|
51 |
|
|
52 |
print $self->parse_html_template($template, $params{locals}); |
|
53 |
} |
|
54 |
|
|
40 | 55 |
# |
41 | 56 |
# private functions -- for use in Base only |
42 | 57 |
# |
... | ... | |
157 | 172 |
C<Form::parse_html_template> which also adds the current object as the |
158 | 173 |
template variable C<SELF>. |
159 | 174 |
|
175 |
=item C<render $template, %params> |
|
176 |
|
|
177 |
Renders the template C<$template> by calling |
|
178 |
L</parse_html_template>. C<$params{locals}> will be used as the second |
|
179 |
parameter to L</parse_html_template>. |
|
180 |
|
|
181 |
If C<$params{title}> is trueish then the function also sets |
|
182 |
C<< $::form->{header} >> to that value and calls C<< $::form->header >>. |
|
183 |
|
|
160 | 184 |
=item C<url_for $url> |
161 | 185 |
|
162 | 186 |
=item C<url_for $params> |
Auch abrufbar als: Unified diff
Hilfsfunktion 'render()' zum Rendern von Templates inklusive Titel & $::form->header
zzgl. notwendiger Anpassung von locales.pl