Commit | Line | Data |
8077080c |
1 | NAME |
2 | Catalyst::View::TT - Template View Class |
3 | |
4 | SYNOPSIS |
5 | # use the helper |
caa61517 |
6 | create.pl view TT TT |
8077080c |
7 | |
8 | # lib/MyApp/View/TT.pm |
9 | package MyApp::View::TT; |
10 | |
11 | use base 'Catalyst::View::TT'; |
12 | |
13 | __PACKAGE__->config->{DEBUG} = 'all'; |
14 | |
15 | 1; |
16 | |
2599ee6f |
17 | # Meanwhile, maybe in an '!end' action |
8077080c |
18 | $c->forward('MyApp::View::TT'); |
19 | |
20 | DESCRIPTION |
caa61517 |
21 | This is the "Template" view class. Your subclass should inherit from |
2599ee6f |
22 | this class. The plugin renders the template specified in |
23 | "$c->stash->{template}" or "$c->request->match". The template variables |
24 | are set up from the contents of "$c->stash", augmented with "base" set |
25 | to "$c->req->base", "c" to $c and "name" to "$c->config->{name}". The |
26 | output is stored in "$c->response->output". |
27 | |
28 | If you want to override TT config settings, you can do it there by |
29 | setting "__PACKAGE__->config->{OPTION}" as shown in the synopsis. Of |
30 | interest might be "EVAL_PERL", which is disabled by default, and |
31 | "LOAD_TEMPLATES", which is set to use the provider. |
8077080c |
32 | |
caa61517 |
33 | If you want to use EVAL perl, add something like this: |
34 | |
35 | __PACKAGE__->config->{EVAL_PERL} = 1; |
36 | __PACKAGE__->config->{LOAD_TEMPLATES} = undef; |
37 | |
2599ee6f |
38 | If you have configured Catalyst for debug output "Catalyst::View::TT" |
39 | will enable profiling of template processing (using "Template::Timer". |
40 | This will cause HTML comments will get embedded in the output from your |
41 | templates, such as: |
42 | |
43 | <!-- TIMER START: process mainmenu/mainmenu.ttml --> |
44 | <!-- TIMER START: include mainmenu/cssindex.tt --> |
45 | <!-- TIMER START: process mainmenu/cssindex.tt --> |
46 | <!-- TIMER END: process mainmenu/cssindex.tt (0.017279 seconds) --> |
47 | <!-- TIMER END: include mainmenu/cssindex.tt (0.017401 seconds) --> |
48 | |
49 | .... |
50 | |
51 | <!-- TIMER END: process mainmenu/footer.tt (0.003016 seconds) --> |
52 | |
53 | You can supress template profiling when debug is enabled by setting: |
54 | |
55 | __PACKAGE__->config->{CONTEXT} = undef; |
56 | |
caa61517 |
57 | METHODS |
8077080c |
58 | process |
2599ee6f |
59 | Renders the template specified in "$c->stash->{template}" or |
60 | "$c->request->match". Template variables are set up from the contents of |
61 | "$c->stash", augmented with "base" set to "$c->req->base", "c" to $c and |
62 | "name" to "$c->config->{name}". Output is stored in |
63 | "$c->response->output". |
8077080c |
64 | |
65 | config |
66 | This allows your view subclass to pass additional settings to the TT |
67 | config hash. |
68 | |
69 | SEE ALSO |
70 | Catalyst. |
71 | |
72 | AUTHOR |
2599ee6f |
73 | Sebastian Riedel, "sri@cpan.org" Marcus Ramberg, "mramberg@cpan.org" |
8077080c |
74 | |
75 | COPYRIGHT |
76 | This program is free software, you can redistribute it and/or modify it |
77 | under the same terms as Perl itself. |
78 | |