@@ -26,7 +26,7 @@ sub build ($self)
2626 my $tpl = $self -> template;
2727
2828 $self -> add_method(
29- controller => render => sub ($controller , $template , $vars = {}) {
29+ controller => template => sub ($controller , $template , $vars = {}) {
3030 return $tpl -> process($template , $vars );
3131 }
3232 );
@@ -51,22 +51,22 @@ Thunderhorse::Module::Template - Template module for Thunderhorse
5151 # in controller method
5252 sub show_page ($self, $ctx)
5353 {
54- return $self->render ('page', {
54+ return $self->template ('page', {
5555 title => 'My Page',
5656 content => 'Hello, World!',
5757 });
5858 }
5959
60- # render from DATA handle
60+ # parse DATA handle
6161 sub render_data ($self, $ctx)
6262 {
63- return $self->render (\*DATA);
63+ return $self->template (\*DATA);
6464 }
6565
6666=head1 DESCRIPTION
6767
6868The Template module adds template rendering capabilities using
69- L<Template::Toolkit> . It adds a L</render > method to controllers.
69+ L<Template::Toolkit> . It adds a L</template > method to controllers.
7070
7171=head1 CONFIGURATION
7272
@@ -91,17 +91,17 @@ case they will be ignored.
9191
9292=head2 Controller Methods
9393
94- =head3 render
94+ =head3 template
9595
96- $self->render ('page', { title => 'My Page' });
97- $self->render (\*DATA);
98- $self->render (\$template_string);
96+ $self->template ('page', { title => 'My Page' });
97+ $self->template (\*DATA);
98+ $self->template (\$template_string);
9999
100- Renders a template and returns the rendered content. The first argument is the
101- template name (C<.tt > suffix will be added automatically), and the second is a
102- hash reference of variables to pass to the template. The method returns the
103- rendered content, which is then sent to the client as HTML (if the context is
104- not already consumed).
100+ Parses a template and returns the content. The first argument is the template
101+ name (C<.tt > suffix will be added automatically), and the second is a hash
102+ reference of variables to pass to the template. The method returns the parsed
103+ content, which can then be returned from the handler to be sent to the client
104+ as HTML (if the context is not already consumed).
105105
106106If the first argument is passed as a reference, the behavior changes:
107107
0 commit comments