package Catalyst::View::TT;
use strict;
-use base qw/Catalyst::Base/;
+use base qw/Catalyst::View/;
use Template;
use Template::Timer;
use NEXT;
-our $VERSION = '0.14';
+our $VERSION = '0.15';
__PACKAGE__->mk_accessors('template');
# configure in lib/MyApp.pm
- our $ROOT = '/home/dent/catalyst/MyApp';
-
MyApp->config({
name => 'MyApp',
- root => $ROOT,
+ root => MyApp->path_to('root');,
'V::TT' => {
# any TT configurations items go here
INCLUDE_PATH => [
- "$ROOT/templates/src",
- "$ROOT/templates/lib"
+ MyApp->path_to( 'root', 'src' ),
+ MyApp->path_to( 'root', 'lib' ),
],
PRE_PROCESS => 'config/main',
WRAPPER => 'site/wrapper',
+ TEMPLATE_SUFFIX => '.tt',
# two optional config items
CATALYST_VAR => 'Catalyst',
use strict;
use base 'Catalyst::View::TT';
- our $ROOT = '/home/dent/catalyst/MyApp';
-
MyApp::V::TT->config({
- INCLUDE_PATH => ["$ROOT/templates/src", "$ROOT/templates/lib"],
+ INCLUDE_PATH => [
+ MyApp->path_to( 'root', 'templates', 'lib' ),
+ MyApp->path_to( 'root', 'templates', 'src' ),
+ ],
PRE_PROCESS => 'config/main',
WRAPPER => 'site/wrapper',
});
sub new {
my $self = shift;
$self->config({
- INCLUDE_PATH => ["$ROOT/templates/src", "$ROOT/templates/lib"],
+ INCLUDE_PATH => [
+ MyApp->path_to( 'root', 'templates', 'lib' ),
+ MyApp->path_to( 'root', 'templates', 'src' ),
+ ],
PRE_PROCESS => 'config/main',
WRAPPER => 'site/wrapper',
});
use strict;
use Catalyst;
- our $ROOT = '/home/dent/catalyst/MyApp';
-
MyApp->config({
name => 'MyApp',
- root => $ROOT,
+ root => MyApp->path_to('root'),
'V::TT' => {
- INCLUDE_PATH => ["$ROOT/templates/src", "$ROOT/templates/lib"],
+ INCLUDE_PATH => [
+ MyApp->path_to( 'root', 'templates', 'lib' ),
+ MyApp->path_to( 'root', 'templates', 'src' ),
+ ],
PRE_PROCESS => 'config/main',
WRAPPER => 'site/wrapper',
},
my $root = $c->config->{root};
my $config = {
- EVAL_PERL => 0,
+ EVAL_PERL => 0,
TEMPLATE_EXTENSION => '',
- INCLUDE_PATH => [ $root, "$root/base" ],
+ INCLUDE_PATH => [ $root, "$root/base" ],
%{ $class->config },
%{$arguments}
};
sub process {
my ( $self, $c ) = @_;
- my $template = $c->stash->{template} || $c->request->match . $self->config->{TEMPLATE_EXTENSION};
+ 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;
MyApp->config({
name => 'MyApp',
- root => $ROOT,
+ root => MyApp->path_to('root'),
'V::TT' => {
CATALYST_VAR => 'Catalyst',
},
<!-- TIMER END: process mainmenu/footer.tt (0.003016 seconds) -->
-=item C<TEMPLATE_EXTENSION>
+=item C<TEMPLATE_SUFFIX>
-an extension to add when looking for templates bases on the C<match> method in L<Catalyst::Request>.
+a sufix to add when looking for templates bases on the C<match> method in L<Catalyst::Request>.
For example: