[Catalyst] Can we use both TT and TTsite at the same time
Jason Kohles
email at jasonkohles.com
Wed Nov 8 13:18:49 GMT 2006
On Nov 8, 2006, at 12:03 AM, Mao DengFeng-e13751 wrote:
> 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
>
I use a view based on TTsite, but heavily modified, that among other
things allows you to control whether the page is wrapped with headers
and footers or not. This is the way I prefer to deal with it:
site/wrapper:
[%
IF template.name.match('\.(css|js|txt)') OR nowrap OR
template.nowrap;
debug("Passing page through as text: $template.name");
content;
ELSE;
debug("Applying HTML page layout wrappers to $template.name
\n");
content WRAPPER site/html + site/layout;
END;
-%]
This way headers are automatically left off files with .css .js
or .txt extensions, and you can manually cause the headers to be left
off other templates by using $c->{ 'stash' }->{ 'nowrap' } = 1 in
your controller method, or by putting [% META nowrap = 1 %] in the
template itself.
--
Jason Kohles
email at jasonkohles.com
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jules.scsys.co.uk/pipermail/catalyst/attachments/20061108/35c99e22/attachment.htm
More information about the Catalyst
mailing list