[Catalyst] Can we use both TT and TTsite at the same time

Mao DengFeng-e13751 e13751 at motorola.com
Thu Nov 9 01:22:33 GMT 2006


oh... this is a well solution.
Thank you very much ,Jason Kohles
 
Thanks to everyone
 
Mao Dengfeng

________________________________

From: Jason Kohles [mailto:email at jasonkohles.com] 
Sent: Wednesday, November 08, 2006 9:19 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Can we use both TT and TTsite at the same time


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/20061109/c73ff010/attachment-0001.htm


More information about the Catalyst mailing list