[dancer-users] TT

Jason A. Crome cromedome at gmail.com
Wed Nov 4 16:53:46 GMT 2015


You don’t (and shouldn’t have to use) Template::Simple if you don’t want to. TIMTOWTDI! :)

Dancer is based on Ruby’s Sinatra framework. Sinatra uses <% %>, which is why they are the default in Dancer.

Just set your start and end tags to [% %] and write your templates in TT the way you are used to. 

Or did I miss something? :)

Good luck!
Jason

> On Nov 4, 2015, at 10:49 AM, Rick Leir <richard.leir at canadiana.ca> wrote:
> 
> TemplateToolkit default tags are [% hi %]
> 
> ref: http://search.cpan.org/~abw/Template-Toolkit-2.26/lib/Template/Manual/Config.pod#START_TAG,_END_TAG
> 
> Dancer2 tutorial mentions this default
> ref: lib/Dancer2/Tutorial.pod
> 
> In Dancer2 I had to configure these to get going:
> 
> template:   "template_toolkit"
> charset: UTF-8
> engines:
>     template:
>         template_toolkit:
>           ENCODING: utf8
>           INCLUDE_PATH: 'views'
>           start_tag: '[%'
>           end_tag:   '%]'
> 
> But then, the rendered template contained <% content %> in place of my tt. To get my code working, I changed my .tt files to use <% hi %> and changed the config tags:
>           start_tag: '<%'
>           end_tag:   '%>'
> 
> Is there an easier way to use Template::Toolkit in Dancer2? Yes, I should use Dancer2's simple template.
> Thanks
> Rick
> 
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users



More information about the dancer-users mailing list