]> git.decadent.org.uk Git - maypole.git/blob - lib/Maypole/View/TT.pm
Shitload of doc fixes.
[maypole.git] / lib / Maypole / View / TT.pm
1 package Maypole::View::TT;
2 use base 'Maypole::View::Base';
3 use Maypole::Constants;
4 use Template;
5
6 sub template {
7     my ( $self, $r ) = @_;
8     my $template = Template->new( { INCLUDE_PATH => [ $self->paths($r) ] } );
9     my $output;
10     if ( $template->process( $r->template, { $self->vars($r) }, \$output ) ) {
11         $r->{output} = $output;
12         return OK;
13     }
14     else {
15         $r->{error} = $template->error;
16         return ERROR;
17     }
18 }
19
20 1;
21
22 =head1 NAME
23
24 Maypole::View::TT - A Template Toolkit view class for Maypole
25
26 =head1 SYNOPSIS
27
28     BeerDB->config->view("Maypole::View::TT"); # The default anyway
29
30 =head1 DESCRIPTION
31
32 This is the default view class for Maypole; it uses the Template Toolkit
33 to fill in templates with the objects produced by Maypole's model classes.
34 Please see the Maypole manual, and in particular, the C<View> chapter,
35 for the template variables available and for a refresher on how template
36 components are resolved.
37
38 =over 4
39
40 =item template
41
42
43 Processes the template and sets the output. See L<Maypole::View::Base>
44
45 =back
46
47
48 =head1 AUTHOR
49
50 Simon Cozens
51
52 =cut
53