dmcglone Posted July 25, 2013 Share Posted July 25, 2013 I'm trying to extend Smarty's Class here and I keep getting this error and can't figure out why. I've used this successfully in the past, but I'm not sure if it was PHP 5.Fatal error: Uncaught exception 'SmartyException' with message 'PHP5 requires you to call __construct() instead of Smarty()' in /media/www/login/Smarty/libs/sysplugins/smarty_internal_templatebase.php:803 Stack trace: #0 /media/www/login/include/setup_smarty.php(14): Smarty_Internal_TemplateBase->__call('Smarty', Array) #1 /media/www/login/include/setup_smarty.php(14): Page->Smarty() #2 /media/www/login/index.php(7): Page->__construct() #3 {main} thrown in /media/www/login/Smarty/libs/sysplugins/smarty_internal_templatebase.php on line 803 here's the code that seems to be at fault: class Page extends Smarty { // constructor function __construct() { // Call Smarty's constructor $this->Smarty(); // Change the default template directories $this->template_dir = TEMPLATE_DIR; $this->compile_dir = COMPILE_DIR; $this->config_dir = CONFIG_DIR; $this->plugins_dir[0] = SMARTY_DIR . '/login/Smarty/libs/plugins'; $this->plugins_dir[1] = SITE_ROOT . "/login/Smarty/libs/plugins"; } } Does anyone know if Smarty has changed with PHP 5? I think that is the culprit, but I'm not sure.Thanks David M. Quote Link to comment https://forums.phpfreaks.com/topic/280484-trying-to-extend-smarty/ Share on other sites More sharing options...
trq Posted July 25, 2013 Share Posted July 25, 2013 No idea, what the Smarty() method does, but it looks like its depricated somehow. Just replace: $this->Smarty(); with parent::__construct(); Quote Link to comment https://forums.phpfreaks.com/topic/280484-trying-to-extend-smarty/#findComment-1442053 Share on other sites More sharing options...
dmcglone Posted July 26, 2013 Author Share Posted July 26, 2013 Thanks trq, that did the trick. I found quite a few other stuff that has changed also. Quote Link to comment https://forums.phpfreaks.com/topic/280484-trying-to-extend-smarty/#findComment-1442212 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.