Clone wiki

ksmarty / Home


Ksmarty is a view replacement for Kohana3. It works with either Smarty2 or Smarty3 (currently in alpha)


  • Clone the repository and copy the 'smarty' directory to the 'modules' directory of your Kohana3 project.
  • Download Smarty and put the contents of the 'libs' folder to 'smarty/vendor/smarty'


Ksmarty mimics the usage of Kohana::View. Please note that, unlike the Kohana::View, template variables are global to all nested views.

Example controller:

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Welcome extends Controller_Template
	public $template = 'welcome';

	public function action_index()
                // Assign a value to the variable 'intro'
		$this->template->intro = 'Hello world!';

                // Create a nested view by loading a different template
		$this->template->content = View::factory('content');
// End Welcome

Template: welcome.tpl


Template: content.tpl

Yes, this works!