5
我想包括模板中的模板,像這樣內模板:Perl的舞蹈家和模板工具包:包括模板
parent.tt
<div class="row-fluid">
<div class="span3">
[% INCLUDE my_sidebar]
</div><!--/span-->
</div>
my_sidebar.tt在同一文件夾中存在父.TT(/ MyApp的/觀看次數)
我已經作出瞭如下修改config.yml: 以絕對
template: "template_toolkit"
engines:
template_toolkit:
encoding: 'utf8'
start_tag: '[%'
end_tag: '%]'
ABSOLUTE : 1
parent.tt包含:
[% INCLUDE /myapps/views/my_sidebar %]
相對
template: "template_toolkit"
engines:
template_toolkit:
encoding: 'utf8'
start_tag: '[%'
end_tag: '%]'
RELATIVE : 1
INCLUDE_PATH: /myapps/views
parent.tt包含:
[% INCLUDE my_sidebar %]
但在這兩種情況下,我得到以下錯誤:
core - template - file error - my_sidebar: not found at /.../csm/64-bit/cpan/5.16.1-2012.09/lib/Dancer/Template/Abstract.pm line 90.
試試這個'[%INCLUDE'my_sidebar.tt'%]' – 2013-02-12 14:17:24