我试图在模板中包含一个模板,如下所示:
parent.tt
<div class="row-fluid"> <div class="span3"> [% INCLUDE my_sidebar] </div><!--/span--> </div>
my_sidebar.tt与parent.tt存在于同一文件夹中(/ myapp / views)
我对config.yml进行了以下更改:
有了ABSOLUTE
template: "template_toolkit" engines: template_toolkit: encoding: 'utf8' start_tag: '[%' end_tag: '%]' ABSOLUTE : 1
parent.tt包含:
[% INCLUDE /myapps/views/my_sidebar %]
有了RELATIVE
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.