[Catalyst] Configuring View::TT per request

Matt S Trout dbix-class at trout.me.uk
Tue Oct 23 20:50:13 GMT 2007

On Sun, Oct 21, 2007 at 07:29:12PM -0700, Devo Coran wrote:
> (sorry I sent to wrong list first time my bad :( )
> Hi,
> I'm new to catalyst and am stuck on how to do this..
> I'm using View::TT and for most of my requests I do
> want it to use the standard config with:
>     PRE_PROCESS        => 'config/main',
>     WRAPPER            => 'site/wrapper',
> However by the same token I have a number of other
> requests, like ajax content coming into a div, where I
> don't want to use those config options or add a
> header/footer etc.
> For now I've been getting around by using [% IF
> somevar %] type blocks to include/exclude header/foot
> content but that's rather hacked, what I really need
> is to be able to configure the View::TT per request.
> I even have one template that I need to display
> without going through TT at all, it needs to show as
> plain text so a user can edit it as is.  For that I
> had to edit the wrapper to pass it through as text
> when it sees a template with that name.
> So again if I could configure View:TT per request I
> can avoid hacks.

Why can't you just use

$c->stash(additional_template_paths => [ ... ])

to add extra search paths that result in a different wrapper/whatever template
being picked up?

      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

More information about the Catalyst mailing list