Dancer::Template::TemplateDeclare - Template::Declare wrapper for Dancer
version 0.3.2
# in 'config.yml' template: 'TemplateDeclare' engines: TemplateDeclare: dispatch_to: - A::Template::Class - Another::Template::Class # in the app get '/foo', sub { template 'foo' => { title => 'bar' }; };
This class is an interface between Dancer's template engine abstraction layer and the Template::Declare templating system.
In order to use this engine, set the template to 'TemplateDeclare' in the configuration file:
template: TemplateDeclare
Parameters can also be passed to the Template::Declare interpreter via the configuration file, like so:
engines: TemplateDeclare: dispatch_to: - Some::Template - Some::Other::Template
All the dispatch classes are automatically loaded behind the scene.
If the layout is set to $name, the template /layout/$name will be used and passed via the content argument.
/layout/$name
content
For example, a simple main layout would be:
main
template '/layout/main' => sub { my ( $self, $args ) = @_; html { body { outs_raw $args->{content} } } };
Dancer, Template::Declare.
Yanick Champoux
This software is copyright (c) 2012 by Yanick Champoux.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dancer::Template::TemplateDeclare, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Template::TemplateDeclare
CPAN shell
perl -MCPAN -e shell install Dancer::Template::TemplateDeclare
For more information on module installation, please visit the detailed CPAN module installation guide.