[Catalyst] Can we use both TT and TTsite at the same time
Marc Logghe
Marc.Logghe at DEVGEN.com
Wed Nov 8 10:09:46 GMT 2006
________________________________
From: Mao DengFeng-e13751 [mailto:e13751 at motorola.com]
Sent: Wednesday, November 08, 2006 6:04 AM
To: The elegant MVC web framework
Subject: [Catalyst] Can we use both TT and TTsite at the same
time
Hi,
TTsite view is more conenience at most time when create a new
page. But TT view is needed in some case.
For example, I try to update some part of a page using AJAX.
This part is also rendered from a template.
If we use TTsite, the header and footer are included when the
template is rendered.
I try to use TTsite for most of the pages but I want to use TT
(without header and footer wrapped)for some special page.
Is there a way to do that
thanks
Mao Dengfeng
Hi,
I tried out 2 ways.
The first way is like you suggest, use TTSite and TT next to
each other.
So, you create your View the usual way (script/my_app_create.pl
view TT TT). In the configuration you remove the lines
PRE_PROCESS => 'config/main',
WRAPPER => 'site/wrapper',
Then in the action you set your template and call
$c->forward($c->view('TT')). This call will set your response body so
that the default call to TTSite is not made anymore.
Another way is to edit root/lib/site/wrapper and add an extra
ELSIF statement:
ELSIF nowrap;
content;
Then in your controller actions that handle an AJAX request you
just have to set $c->stash->{nowrap} = 1.
Cheers,
Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jules.scsys.co.uk/pipermail/catalyst/attachments/20061108/80e235da/attachment.htm
More information about the Catalyst
mailing list