Strict standards: the non-static STemplate :: assign () method should not be called statically

i Upgrade my old xampp host server (1.7.3) to 1.8.0. Now, do not work with the smarty template engine driver (2.6.6) on my page and I see a Strict Standards error. what problem? How to fix it?

NOTE : This Wroked Fine In Old Xampp(1.7.3).

Error Section:

 Strict Standards: Non-static method STemplate::assign() should not be called statically in C:\xampp\htdocs\tube\include\config.php on line 88 Strict Standards: Non-static method STemplate::create() should not be called statically in C:\xampp\htdocs\tube\libraries\mysmarty.class.php on line 42 Strict Standards: Non-static method STemplate::setCompileDir() should not be called statically in C:\xampp\htdocs\tube\include\config.php on line 181 Strict Standards: Non-static method STemplate::setTplDir() should not be called statically in C:\xampp\htdocs\tube\include\config.php on line 182 

My Config configuration error:

 STemplate::assign($field, $config[$field]); // line 88 STemplate::setCompileDir($config['basedir']."/temporary"); // line 181 STemplate::setTplDir($config['basedir']."/themes"); // line 182 

my.Smarty.class.php (error line 2)

 function assign($var, $value) { global $Smarty; if (!isset($Smarty)) { STemplate::create(); // <---- line 42 } $Smarty->assign($var, $value); } 

Thanks for any help :)

+2
source share
1 answer

This is because you are using a modern version of PHP with strict standards . You can get the code to work by declaring:

 public static function assign($var, $value) 

However, judging by other errors, you will encounter many problems. You can try disabling strict standards, but it’s best to upgrade to a new version of Smarty .

+3
source

All Articles