The integration of Twig, for Magento.
Tested under Magento 1.4.1.1
- Download Twig
- Copy the lib/Twig directory to your magento lib/ directory
- Copy this extension to your Magento directory
When writing a block for Magento, just extend your block from Mashpress_Twig_Block_Template.
class MyCompany_MyModule_Block_MyBlock extends Mashpress_Twig_Block_Template { }
If you want to give access to a function written in your block to your template, just add a “TwigExtention” suffix to your function:
class MyCompany_MyModule_Block_MyBlock extends Mashpress_Twig_Block_Template { public function myFunctionTwigExtention() { return "Hello"; } }
However, in your template, you have to use the name of the function without the “TwigExtension” suffix:
{{ myFunction() }}
“Magento-Twig” The Twig integration for Magento.
Copyright © 2011 Hugues Alary <hugues.alary@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.