MrAnchovy / Kohana_Smarty3

Integration of Smarty v3 with the Kohana PHP Framework
25 stars 13 forks source link

Class 'Smarty' not found when using View::bind_global #5

Closed tchemineau closed 12 years ago

tchemineau commented 13 years ago

With this simple code:

public function before ()
{
    parent::before();
    $v = 'test';
    View::bind_global('V', $v);
}

I got the following error in Kohana 3.2:

2011-08-10 07:54:45 --- ERROR: ErrorException [ 1 ]: Class 'Smarty' not found ~ MODPATH/smarty/classes/view.php [ 45 ]
2011-08-10 07:54:45 --- STRACE: ErrorException [ 1 ]: Class 'Smarty' not found ~ MODPATH/smarty/classes/view.php [ 45 ]
--
#0 [internal function]: Kohana_Core::shutdown_handler()
#1 {main

With the following output:


MODPATH/smarty/classes/view.php [ 45 ]

40  * @param   mixed   referenced variable
41  * @return  void
42  */
43 public static function bind_global($key, & $value) {
44   View::$_global_data[$key] = &$value;
45   Smarty::$global_tpl_vars[$key] = new Smarty_variable($value, $nocache);
46   Smarty::$global_tpl_vars[$key]->value = &$value;
47   return $this;
48 }
49 
50 /**

Using _View::setglobal seems to work well. I notice that _View::bingglobal want to use a _Smartyvariable object; maybe this class is not loaded ?

MrAnchovy commented 12 years ago

Oops, don't know how I missed this before.

Fixed: https://github.com/MrAnchovy/Kohana_Smarty3/commit/ec11599b51f32824a1ff62064108e559c422965a