[Catalyst] Configuring View::TT per request
Bill Moseley
moseley at hank.org
Mon Oct 22 22:53:49 GMT 2007
On Sun, Oct 21, 2007 at 07:29:12PM -0700, Devo Coran wrote:
> 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.
For most ajax responses I would use a separate view. But,
for html content I want returned w/o headers and footers but still
rendered with the same templates I use logic in my WRAPPER template
to decide to return just [% content %]. So, similar to what you are
describing.
My WRAPPER template simply looks at the request headers to decide if
its an ajax request. The only time I use this is when I want to return
a page complete page segment via ajax. I do with with some tabbed
pages, for example.
--
Bill Moseley
moseley at hank.org
More information about the Catalyst
mailing list