Parse a yaml file and injects its content as a twig variable.
- Craft 2.5+
- PHP 5.6+
- Download the latest release of the plugin
- Drop the
yml2twig
plugin folder tocraft/plugins
- Create a file
yml2twig.yml
at the root of your craft templates folder - Install Yml2twig plugin from the control panel in
Settings > Plugins
- Inside your twig template, you can load your YAML content like this :
{% set var = craft.yml2twig.content %}
- You can access to a YAML entry like this :
{{ var.yamlentry.yamlsubentry }}
You should consider to define your twig variable inside a root template and extends it. This way, your var is available inside all subtemplates.
justdoweb.be © 2017 - All rights reserved