Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c0f198fa

Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt

  • ID c0f198fa60b783b3fcdabf6e8a2e121bb2794662
  • Vorgänger 11093bd5
  • Nachfolger 5a2a3ac3

Hilfsfunktion 'render()' zum Rendern von Templates inklusive Titel & $::form->header

zzgl. notwendiger Anpassung von locales.pl

Unterschiede anzeigen:

SL/Controller/Base.pm
print $::cgi->redirect($url);
}
sub render {
my $self = shift;
my $template;
$template = shift if scalar(@_) % 2;
my %params = @_;
if ($params{title}) {
$::form->{title} = delete $params{title};
$::form->header;
}
print $self->parse_html_template($template, $params{locals});
}
#
# private functions -- for use in Base only
#
......
C<Form::parse_html_template> which also adds the current object as the
template variable C<SELF>.
=item C<render $template, %params>
Renders the template C<$template> by calling
L</parse_html_template>. C<$params{locals}> will be used as the second
parameter to L</parse_html_template>.
If C<$params{title}> is trueish then the function also sets
C<< $::form->{header} >> to that value and calls C<< $::form->header >>.
=item C<url_for $url>
=item C<url_for $params>
scripts/locales.pl
}
# is this a template call?
if (/parse_html_template2?\s*\(\s*[\"\']([\w\/]+)\s*[\"\']/) {
if (/(?:parse_html_template2?|render)\s*\(\s*[\"\']([\w\/]+)\s*[\"\']/) {
my $newfile = "$basedir/templates/webpages/$1.html";
if (/parse_html_template2/) {
print "E: " . strip_base($file) . " is still using 'parse_html_template2' for " . strip_base($newfile) . ".\n";

Auch abrufbar als: Unified diff