I use Template Toolkit to generate views of pages in Catalyst. To do some basic Ajax, I want to have some output pages not use the TTSite style, but a much more basic structure. Do I put something special into the stash to use a .tt2 file without the header/footer/etc that automatically comes with the rest of my templates? (site generated following tutorial instructions.)
+3
A:
Aha, lib/projectname/View/TT.pm has:
WRAPPER => 'site/wrapper',
and in root/lib/site/wrapper, I find:
[% IF template.name.match('\.(css|js|txt)');
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;
-%]
So if I name my non-wrapper template .txt, I can avoid site/html + site/layout.
Or maybe even better, I can make a .ajax extension and add that to the list of pass-through templates.
Thelema
2008-12-17 18:34:14
Nice! I'll have to remember this if I ever have to pass data back through AJAX from my Catalyst apps.
Adam Bellaire
2008-12-17 18:40:47
Same. Dual headers and footers. :-)
Alan Haggai Alavi
2009-10-21 15:35:50