fvsch / kirby-twig

Twig templating support for Kirby CMS 2. For Kirby 3, use https://github.com/amteich/kirby-twig
MIT License
70 stars 8 forks source link

How to output config values, getting an error? #20

Closed Sananes closed 7 years ago

Sananes commented 7 years ago

Hi guys,

When using {{ l__get(configName, defaultValue) }} to get any config values that I have in site/languages/ gives me an error of Unknown "l__get" function. Any reason why?

Your help will be much appreciated! Thanks in advance :)

fvsch commented 7 years ago

Hi, I can’t reproduce this with Kirby 3.0.0.

With default config, and no language config files:

Outputs "bar": {{ l__get('foo', 'bar') }}

Did you use the c::set('twig.functions', […]); and/or c::set('twig.function.*, …);` config? If yes, can you show your config?

Can you try defining a l::get shortcut in your config?

c::set('twig.function.l', 'l::get');
{{ l('foo', 'bar') }}
Sananes commented 7 years ago

First of all, thanks for the super speedy response! That worked an absolute treat, thanks a bunch @fvsch !