It took me a while to set up a TinuButStrong template engine into Kohana. I hope, this post will help You do it faster. You will need at least revision 1690 of Kohana (it didn’t worked for me with stable release). You can download it manually from their SVN/Trac or build rpm package from kohana.spec on DEVEL branch for PLD-Linux.
You will need to add some files to Your application/ dir.
libraries/MY_Controller.php:
[php]tbs->LoadTemplate($template);
if (is_array($vars) && count($vars) > 0)
{
foreach ($vars as $key => $val)
{
if(is_array($val))
{
$this->tbs->MergeBlock($val[‚name’], $val[‚data’]);
}
else
{
$this->tbs->MergeField($key, $val);
}
}
}

Additionally, upload the tbs_class_php5.php file into libraries/ too. You can also upload it to vendors/ dir and load it using Kohana loader classes.
You can autoload it in config/config.php by adding tbs into the autoload property:
[php]
$config[‚autoload’] = array
(
‚libraries’ => ‚tbs, session, database’
)
[/php]
If $data array would contain another array, it will be processed with MergeBlock(), otherwise it will be MergeFielded().
Now, You’re ready to use it with Your app.
controllers/module.php:
[php]load->model(‚menu’);
$menu = $this->menu->ListModules($dist_id, $arch_id);