Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How do you use Template Toolkit with Dancer2?

by Corion (Patriarch)
on Jan 17, 2022 at 12:23 UTC ( [id://11140536]=note: print w/replies, xml ) Need Help??


in reply to How do you use Template Toolkit with Dancer2?

The Template::Toolkit templates have a different syntax than the default Dancer templating system. You will have to rewrite the existing templates to use TT syntax ([% ... %]) or switch Template::Toolkit to use <% ... %> as syntax and then look at where the Dancer template system differs from TT.

Update: Just as I've posted this, I also read the same thing in Dancer::Template::TemplateToolkit. It seems you can even switch to <% ... %> syntax from within the config:

template: template_toolkit engines: template_toolkit: start_tag: '[%' stop_tag: '%]'

Update 2: This is the documentation for Dancer, not Dancer2... For Dancer2, it's the other way around (Dancer2::Template::TemplateToolkit) :

engines: template: template_toolkit: start_tag: '<%' end_tag: '%>'

Replies are listed 'Best First'.
Re^2: How do you use Template Toolkit with Dancer2?
by v3ritas (Initiate) on Jan 17, 2022 at 12:55 UTC

    Thanks!

    Also, I discovered I had turned on a different piece of config as well: the YAML session engine block at the bottom of the config.yml file.

    It was that session engine block which was breaking things. As soon as I turned that off, the page worked again.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11140536]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found