[dancer-users] Dancer2 template engines and config

WK wanradt at gmail.com
Tue Mar 5 18:08:27 GMT 2013


Tere!

I tried to ask same question at IRC too, but got no answers. I try add
some bits more here.

I like D:T:Xslate template engine and am trying to convert it to
Dancer2.  I have trouble understanding some points how template
engines should get data from config file.

When i look 3 default templates, they all rely on $self->config but
$self->config carries only two attributes in: environment and
location.
And those 2 are not from config-file.

When i tried to change defaults of template_toolkit plugin in config
file, they did not worked. I tried to change start_tag and end_tag,
but defaults overrun them and from code i see, that alternative tags
are looked from  $self->config->{'start_tag'}. Which are not available
through $self->config.

Some days ago i got suggestion from racke to look toward
$self->context->app->config. Yes, this is possible, but i have not
seen it in default engines. And to get config into, one should write
something like $self->context->app->config->{engines}{template_toolkit}.
It seems a bit complicated.

Should this  be the official/idiomatic way to get config for template?

--
Wbr,
Kõike hääd,

Gunnar


More information about the dancer-users mailing list