waldson / twig-module-for-kohana
为 Kohana 3.3 开发的 TWIG 模块,可无缝使用 twig 模板作为 Kohana 视图
0.1
2013-02-10 23:38 UTC
Requires
- php: >=5.2
- composer/installers: *
- twig/twig: 1.*
This package is not auto-updated.
Last update: 2024-09-28 13:12:00 UTC
README
为 Kohana 3.3 开发的 TWIG 模块,可无缝使用模板作为 Kohana 视图。
使用方法
// inside an action in your controller... $this->response->body(Twig_View::factory('path/to/your/twig/view');
还有一个模板控制器
class Controller_Welcome extends Twig_Controller_Template { //default $template is twig/template public $template = 'path/to/your/template'; function action_index() { $this->var = 'value'; $this->foo = View::factory('your_normal_kohana_view'); $this->bar = Twig_View::factory('your_twig_view', array('view_var' => 'view_value')); } }