PHP code example of waldson / twig-module-for-kohana

1. Go to this page and download the library: Download waldson/twig-module-for-kohana library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

waldson / twig-module-for-kohana example snippets


// 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'));
	}

}