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.)
Asked
Active
Viewed 1,287 times
1 Answers
3
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
- 14,257
- 6
- 27
- 35
-
1Nice! I'll have to remember this if I ever have to pass data back through AJAX from my Catalyst apps. – Adam Bellaire Dec 17 '08 at 18:40
-
Same. Dual headers and footers. :-) – Alan Haggai Alavi Oct 21 '09 at 15:35