Returns the template with all the values filled in.
return $template->output();
You can also supply names and values to the template at this
stage:
return $template->output('name' => 'value', 'name2' => 'value2');
Before the template output is generated, the
"template_pre_process" hook is called.
Any callbacks that you register to this hook will be called before each
template is processed. Register a
"template_pre_process" callback as
follows:
$self->add_callback('template_pre_process', \&my_tmpl_pre_process);
Pre-process callbacks will be passed a reference to the
$template object, and can can modify the
parameters passed into the template by using the
"param" method:
sub my_tmpl_pre_process {
my ($self, $template) = @_;
# Change the internal template parameters by reference
my $params = $template->get_param_hash;
foreach my $key (keys %$params) {
$params{$key} = to_piglatin($params{$key});
}
# Can also set values using the param method
$template->param('foo', 'bar');
}
After the template output is generated, the
"template_post_process" hook is
called. You can register a
"template_post_process" callback as
follows:
$self->add_callback('template_post_process', \&my_tmpl_post_process);
Any callbacks that you register to this hook will be called
after each template is processed, and will be passed both a reference to
the template object and a reference to the output generated by the
template. This allows you to modify the output of the template:
sub my_tmpl_post_process {
my ($self, $template, $output_ref) = @_;
$$output_ref =~ s/foo/bar/;
}
When you call the "output"
method, any components embedded in the template are run. See
"EMBEDDED COMPONENTS", below.