views:

642

answers:

1

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
Nice! I'll have to remember this if I ever have to pass data back through AJAX from my Catalyst apps.
Adam Bellaire
Same. Dual headers and footers. :-)
Alan Haggai Alavi