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>
}
# 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";