[Dancer-users] Feeding options to Dancer::Template::HtmlTemplate

David Precious davidp at preshweb.co.uk
Thu Feb 16 12:06:31 CET 2012


On Wed, 15 Feb 2012 19:46:36 +0000
GJ <gj at freeshell.org> wrote:

> Hi all,
> 
> I am migrating a vanilla CGI application that relies on
> HTML::Template to dancer, and so of course I will use the
> Dancer::Template::HtmlTemplate library for now.  
> 
> Where do I feed my usual HTML::Template options like
> loop_context_vars, global_vars, and so on to the plugin? The source
> code indicates that there is a %{$self->config} that is passed on to
> HTML::Template, but its not clear to me when to fill this out.  

That should come from the template engine's config in config.yml - so
you'd want something like:

  engines:
    HtmlTemplate:
      loop_context_vars: ...
      global_var: ...


Whilst that's how it works for all the template engines, it should
probably be documented better - I'll try to find a moment to update the
docs to show an example.

Cheers

Dave P


-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github


More information about the Dancer-users mailing list