dev-master
9999999-dev https://github.com/yiiext/twig-rendererTwig renderer for the Yii Framework.
BSD-3-Clause
The Requires
- php >=5.1.0
- twig/twig 1.*
twig extension yii renderer
Twig renderer for the Yii Framework.
This extension allows you to use Twig templates in Yii., (*1)
vendor/Twig
.fabpot-Twig-______.zip\fabpot-Twig-______\lib\Twig\
under protected/vendor/Twig
.<?php 'viewRenderer' => array( 'class' => 'ext.ETwigViewRenderer', // All parameters below are optional, change them to your needs 'fileExtension' => '.twig', 'options' => array( 'autoescape' => true, ), 'extensions' => array( 'My_Twig_Extension', ), 'globals' => array( 'html' => 'CHtml' ), 'functions' => array( 'rot13' => 'str_rot13', ), 'filters' => array( 'jencode' => 'CJSON::encode', ), // Change template syntax to Smarty-like (not recommended) 'lexerOptions' => array( 'tag_comment' => array('{*', '*}'), 'tag_block' => array('{', '}'), 'tag_variable' => array('{$', '}') ), ),
{ "repositories":[ { "type":"package", "package":{ "name":"yiiext/twig-renderer", "version":"1.1.15", "source":{ "type":"git", "url":"https://github.com/yiiext/twig-renderer", "reference":"v1.1.15" } } } ], "require":{ "php":">=5.3.0", "yiisoft/yii": "dev-master", "twig/twig": "1.*", "yiiext/twig-renderer":"1.1.*" } }
composer update
in the protected folder of your app.<?php 'viewRenderer' => array( 'class' => 'application.vendor.yiiext.twig-renderer.ETwigViewRenderer', 'twigPathAlias' => 'application.vendor.twig.twig.lib.Twig', // All parameters below are optional, change them to your needs 'fileExtension' => '.twig', 'options' => array( 'autoescape' => true, ), 'extensions' => array( 'My_Twig_Extension', ), 'globals' => array( 'html' => 'CHtml' ), 'functions' => array( 'rot13' => 'str_rot13', ), 'filters' => array( 'jencode' => 'CJSON::encode', ), // Change template syntax to Smarty-like (not recommended) 'lexerOptions' => array( 'tag_comment' => array('{*', '*}'), 'tag_block' => array('{', '}'), 'tag_variable' => array('{$', '}') ), ),
<div id="mainmenu"> {{ this.widget('zii.widgets.CMenu',{ 'items':[ {'label':'Home', 'url':['/site/index']}, {'label':'About', 'url':{0:'/site/page', 'view':'about'} }, {'label':'Contact', 'url':['/site/contact']}, {'label':'Login', 'url':['/site/login'], 'visible':App.user.isGuest}, {'label':'Logout ('~App.user.name~')', 'url':['/site/logout'], 'visible':not App.user.isGuest} ] }, true) }} </div><!-- mainmenu -->
Twig renderer for the Yii Framework.
BSD-3-Clause
twig extension yii renderer