I am trying to INCLUDE a template within a template, like so:
parent.tt
<div class="row-fluid">
<div class="span3">
[% INCLUDE my_sidebar]
</div><!--/span-->
</div>
my_sidebar.tt exists in same folder as parent.tt (/myapp/views)
I have made the following changes to config.yml: With ABSOLUTE
template: "template_toolkit"
engines:
template_toolkit:
encoding: 'utf8'
start_tag: '[%'
end_tag: '%]'
ABSOLUTE : 1
parent.tt contains:
[% INCLUDE /myapps/views/my_sidebar %]
With RELATIVE
template: "template_toolkit"
engines:
template_toolkit:
encoding: 'utf8'
start_tag: '[%'
end_tag: '%]'
RELATIVE : 1
INCLUDE_PATH: /myapps/views
parent.tt contains:
[% INCLUDE my_sidebar %]
But in both cases, I get the following error:
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.
You need to include the full filename - my_sidebar.tt
- in your INCLUDE
. Dancer automatically appends a configurable extension (.tt
by default) to the name of the main template, but TT doesn't know about that setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With