blog vipa
mój dzień to 3 filiżanki kawy

blog vipa

TBS in Kohana 2.2+

marzec 26th, 2008 . by vip

Due to changes in 2.2 (upgrade notes) some changes in TinyButStrong template integration files are needed. In MY_Controller.php You’ve manually create instance

PHP:
  1. $tbs = new Tbs;

of TBS somewhere, and get rid of $this->tbs (just delete this-> string), cause config.php’s autoloading has been disabled.

Next, change Your MY_View.php to like this:

PHP:
  1. <?php defined(‘SYSPATH’) or die(‘No direct script access.’);
  2.  
  3. class View extends View_Core
  4. {
  5.     public function __construct($name, $data = NULL, $type = NULL)
  6.     {
  7.         if (!Kohana::find_file(‘views’, $name, FALSE, FALSE)) // try global extension first
  8.         {
  9.             if (!Kohana::find_file(‘views’, $name, TRUE, “html”))
  10.             {
  11.                 $type = false;
  12.             }
  13.             else
  14.             {
  15.                 $name .= “html”;
  16.             }
  17.         }
  18.  
  19.         parent::__construct($name, $data, $type);
  20.     }
  21. }

And You’re done. You’ve to adapt examples too.
It works great on trunk rev. 2323 with TBS 3.3.0. Happy coding.



Leave a Reply