如何在Catalyst站点上使用多个Template Toolkit TTSite视图?

时间:2008-12-17 18:09:28

标签: ajax perl frameworks catalyst template-toolkit

我使用Template Toolkit生成Catalyst中的页面视图。要做一些基本的Ajax,我想让一些输出页使用TTSite风格,但是更基本的结构。我是否在存储中添加了一些特殊内容以使用.tt2文件而不使用其他模板自动附带的页眉/页脚/等? (按照教程说明生成的网站。)

1 个答案:

答案 0 :(得分:3)

Aha,lib / projectname / View / TT.pm有:

WRAPPER      => 'site/wrapper',

在root / lib / site / wrapper中,我找到了:

[% 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;
-%]

因此,如果我将非包装模板命名为.txt,我可以避免使用site / html + site / layout。

或者甚至更好,我可以创建一个.ajax扩展名并将其添加到传递模板列表中。

相关问题