Twig 2.0 & Twig extensions integration for Joomla! https://phproberto.github.io/joomla-twig/
Twig 2.0 & Twig extensions integration for Joomla!
After integrating Twig with some projects I found the need to create some kind of standard package that can be used & extended by anbody at any project.
This Twig integration includes common global variables & functions required when using Twig in Joomla!
Some highlights:
Example usage:
JLoader::import('twig.library');
// This will render a twig layout in: templates/{ACTIVE_TEMPLATE}/html/view.html.twig
echo Twig::render('@template/view.html.twig');
You can find more examples/usages in the documentation;
For a fast test you can now use the integrated examples.html.twig inside the library. Enable debug mode in your Joomla configuration and add this code to wherever you want to display examples (for example in your template index.php):
JLoader::import('twig.library');
echo Twig::render('@library/twig/examples.html.twig');
See https://phproberto.github.io/joomla-twig/ for detailed documentation.
This library is licensed under GNU LESSER GENERAL PUBLIC LICENSE.
Copyright (C) 2017 Roberto Segura López - All rights reserved.