Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/280484-trying-to-extend-smarty/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.