Jump to content


Photo

Trying to extend Smarty


  • Please log in to reply
2 replies to this topic

#1 dmcglone

dmcglone

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationColumbus, Ohio

Posted 24 July 2013 - 10:42 PM

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.


Blessings,
David M.

#2 trq

trq

    Advanced Member

  • Administrators
  • 30,991 posts
  • LocationSydney, Australia.

Posted 25 July 2013 - 01:32 AM

No idea, what the Smarty() method does, but it looks like its depricated somehow.

Just replace:

$this->Smarty();
with

parent::__construct();

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#3 dmcglone

dmcglone

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationColumbus, Ohio

Posted 25 July 2013 - 07:15 PM

Thanks trq, that did the trick. I found quite a few other stuff that has changed also.


Blessings,
David M.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com