public function _kohana_load_view($template, $vars) { if ($template == '') { return; } if (substr(strrchr($template, '.'), 1) === Kohana::config('smarty.templates_ext')) { // Assign variables to the template if (is_array($vars) and count($vars) > 0) { foreach ($vars as $key => $val) { $this->MY_Smarty->assign($key, $val); } } // Send Kohana::instance to all templates $this->MY_Smarty->assign('this', $this); // Fetch the output $output = $this->MY_Smarty->fetch($template); } else { $output = parent::_kohana_load_view($template, $vars); } return $output; }