Search code examples
perlcatalysttemplate-toolkit

How can I customize Catalyst::View::TTSite?


I use Catalyst::View::TT and Catalyst::View::TTSite for templating, and I find the pre-created templates really useful, but would like to modify them to suit my needs.

This is because I always end up changing the header, css and layout in the same way every time I start an application (I include jquery, and bootstrap links, and use a different color schema).

How would I go about subclassing the module, and what parts should I change? I suppose the helper, but can anyone offer advice?


Solution

  • I was just experimenting so there is probably a better/more robust/more elegant solution.

    catalyst.pl MyApp

    cd MyApp

    mkdir -p lib/Catalyst/Helper/View

    wget --output-document lib/Catalyst/Helper/View/TTMySite.pm http://api.metacpan.org/source/JJNAPIORK/Catalyst-View-TT-0.41/lib/Catalyst/Helper/View/TTSite.pm

    vim lib/Catalyst/Helper/View/TTMySite.pm
    1. Change package name from TTSite to TTMySite
    2. change the template source according to your requirements

    ./script/myapp_create.pl view HTML TTMySite