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=27a64226402e076a2b1c83cf3c5a53096ba02c35;hpb=d938377bd7ecd7eef5c5daa041bc0140cbf03b76;p=catagits%2FCatalyst-View-TT.git diff --git a/lib/Catalyst/View/TT.pm b/lib/Catalyst/View/TT.pm index 27a6422..87f7cc0 100644 --- a/lib/Catalyst/View/TT.pm +++ b/lib/Catalyst/View/TT.pm @@ -6,7 +6,7 @@ use Template; use Template::Timer; use NEXT; -our $VERSION = '0.07'; +our $VERSION = '0.14'; __PACKAGE__->mk_accessors('template'); @@ -16,111 +16,406 @@ Catalyst::View::TT - Template View Class =head1 SYNOPSIS - # use the helper - create.pl view TT TT +# use the helper to create View + myapp_create.pl view TT TT + +# configure in lib/MyApp.pm + + our $ROOT = '/home/dent/catalyst/MyApp'; + + MyApp->config({ + name => 'MyApp', + root => $ROOT, + 'V::TT' => { + # any TT configurations items go here + INCLUDE_PATH => [ + "$ROOT/templates/src", + "$ROOT/templates/lib" + ], + PRE_PROCESS => 'config/main', + WRAPPER => 'site/wrapper', + + # two optional config items + CATALYST_VAR => 'Catalyst', + TIMER => 1, + }, + }); + +# render view from lib/MyApp.pm or lib/MyApp::C::SomeController.pm + + sub message : Global { + my ( $self, $c ) = @_; + $c->stash->{template} = 'message.tt2'; + $c->stash->{message} = 'Hello World!'; + $c->forward('MyApp::V::TT'); + } - # lib/MyApp/View/TT.pm - package MyApp::View::TT; +# access variables from template - use base 'Catalyst::View::TT'; + The message is: [% message %]. + + # example when CATALYST_VAR is set to 'Catalyst' + Context is [% Catalyst %] + The base is [% Catalyst.req.base %] + The name is [% Catalyst.config.name %] + + # example when CATALYST_VAR isn't set + Context is [% c %] + The base is [% base %] + The name is [% name %] + +=head1 DESCRIPTION + +This is the Catalyst view class for the L