Skip to content

huguesalary/Magento-Twig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Magento-Twig

The integration of Twig, for Magento.

Tested under Magento 1.4.1.1

INSTALLATION

- Download Twig
- Copy the lib/Twig directory to your magento lib/ directory
- Copy this extension to your Magento directory

USAGE

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() }}

LICENCE

“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/>.

About

Twig integration for Magento

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages