X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FView%2FTT.pm;h=87f7cc002a43cd78f1723f928451d97d826eca0a;hb=4729c1020d3c1f113ac11973d94bcb4b53c17d3c;hp=0938f628e903c0c0873041f56867f03266174b74;hpb=1749a637bec49cca68dd5c4a4419684268c48196;p=catagits%2FCatalyst-View-TT.git diff --git a/lib/Catalyst/View/TT.pm b/lib/Catalyst/View/TT.pm index 0938f62..87f7cc0 100644 --- a/lib/Catalyst/View/TT.pm +++ b/lib/Catalyst/View/TT.pm @@ -202,52 +202,12 @@ These can be accessed from the template in the usual way: The base is [% base %] The name is [% name %] -If you prefer, you can set the C configuration item to -define the name of a template variable through which the context can -be referenced. - - MyApp->config({ - name => 'MyApp', - root => $ROOT, - 'V::TT' => { - CATALYST_VAR => 'Catalyst', - }, - }); - -F: - - The base is [% Catalyst.req.base %] - The name is [% Catalyst.config.name %] The output generated by the template is stored in C<$c-Eresponse-Eoutput>. =head2 TEMPLATE PROFILING -If you have configured Catalyst for debug output, -C will enable profiling of template processing -(using L). This will embed HTML comments in the -output from your templates, such as: - - - - - - - - .... - - - -You can suppress template profiling by setting the C configuration -item to a false value. - - MyApp->config({ - 'V::TT' => { - TIMER => 0, - }, - }); - =head2 METHODS =over 4 @@ -266,6 +226,7 @@ sub new { my $config = { EVAL_PERL => 0, + TEMPLATE_EXTENSION => '', INCLUDE_PATH => [ $root, "$root/base" ], %{ $class->config }, %{$arguments} @@ -320,7 +281,7 @@ Output is stored in C<$c-Eresponse-Eoutput>. sub process { my ( $self, $c ) = @_; - my $template = $c->stash->{template} || $c->request->match; + my $template = $c->stash->{template} || $c->request->match . $self->config->{TEMPLATE_EXTENSION}; unless ($template) { $c->log->debug('No template specified for rendering') if $c->debug; @@ -362,8 +323,61 @@ sub process { =item config This method allows your view subclass to pass additional settings to -the TT configuration hash, or to set the C and C -options. +the TT configuration hash, or to set the options as below: + +=over 2 + +=item C + +Allows you to change the name of the Catalyst context object. If set, it will also +remove the base and name aliases, so you will have access them through . + +For example: + + MyApp->config({ + name => 'MyApp', + root => $ROOT, + 'V::TT' => { + CATALYST_VAR => 'Catalyst', + }, + }); + +F: + + The base is [% Catalyst.req.base %] + The name is [% Catalyst.config.name %] + +=item C + +If you have configured Catalyst for debug output, and turned on the TIMER setting, +C will enable profiling of template processing +(using L). This will embed HTML comments in the +output from your templates, such as: + + + + + + + + .... + + + + +=item C + +an extension to add when looking for templates bases on the C method in L. + +For example: + + package MyApp::C::Test; + sub test : Local { .. } + +Would by default look for a template in /test/test. If you set TEMPLATE_EXTENSION to '.tt', it will look for +/test/test.tt. + +=back =back