
jshirley at gmail
Oct 20, 2008, 8:55 AM
Post #2 of 4
(891 views)
Permalink
|
|
Re: How to use self made Template Toolkit plugins?
[In reply to]
|
|
On Mon, Oct 20, 2008 at 5:39 AM, <kakimoto [at] tpg> wrote: > > hi there > i am thinking of writing some template toolkit plugins for use within > my *.tt2 files. > > I read the Template toolkit book but of course, this is catalyst so some > things (ie configuration) is different > Not really, the hash that is passed into MyApp->config->{'View::TT'} is passed into TT's ->new, so it is just plain old config. Your question is also exclusive to Catalyst::View::TT, which is a very brief RTFS: http://search.cpan.org/src/MRAMBERG/Catalyst-View-TT-0.27/lib/Catalyst/View/TT.pm That should allow you to figure out how the TT object is being created. > 1) how do I tell my *.tt2 file that a certain template is to be found in > a certain location? > As documented in Catalyst::View::TT, you just add entries into INCLUDE_PATH MyApp->config( 'View::TT' => { INCLUDE_PATH => [. MyApp->path_to( 'root', 'src' ), # root/src MyApp->path_to( 'root', 'lib' ), # root/lib ], } ); > 2) where is the best place (based on best practices) to store the plugin > files for TT2? > The same way every other plugin works. Code it like it is going on CPAN, and install it - extra points for using local::lib for your dependencies, too, so you have a separation from your system's site perl. -J _______________________________________________ List: Catalyst [at] lists Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst [at] lists/ Dev site: http://dev.catalyst.perl.org/
|