|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
tunde_ajao Smarty Rookie
Joined: 23 Aug 2011 Posts: 8
|
Posted: Tue Jun 05, 2012 11:18 am Post subject: Fatal error: Uncaught exception 'SmartyException' |
|
|
I tried setting up smarty after some time and got this error .... any suggestions?
Fatal error: Uncaught exception 'SmartyException' with message 'PHP5 requires you to call __construct() instead of Smarty()' in C:\Program [/b]Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php:803 Stack trace: #0 C:\Program Files\EasyPHP 2.0\www\tshirtshop\Presentation\application.php(12): Smarty_Internal_TemplateBase->__call('Smarty', Array) #1 C:\Program Files\EasyPHP 2.0\www\tshirtshop\Presentation\application.php(12): Smarty->Smarty() #2 C:\Program Files\EasyPHP 2.0\www\tshirtshop\index.php(9): Application->__construct() #3 {main} thrown in C:\Program Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php on line 803
[/b] |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
tunde_ajao Smarty Rookie
Joined: 23 Aug 2011 Posts: 8
|
Posted: Tue Jun 05, 2012 7:05 pm Post subject: |
|
|
Thanks very much for the help, when I placed
parent::__construct();
in the code I got ....
//Class constructor
public function __construct()
{
//Call Smarty's constructor
//parent::Smarty();
parent::__construct();
//Change the default template directories
$this->template_dir = TEMPLATE_DIR;
$this->compile_dir = COMPILE_DIR;
$this->config_dir = CONFIG_DIR;
}
But I came with another error
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to read config file 'site.conf'' in C:\Program Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_internal_resource_file.php:68 Stack trace: #0 C:\Program Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_config_source.php(86): Smarty_Internal_Resource_File->getContent(Object(Smarty_Config_Source)) #1 C:\Program Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_internal_config_file_compiler.php(81): Smarty_Config_Source->__get('content') #2 C:\Program Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_internal_config.php(189): Smarty_Internal_Config_File_Compiler->compileSource(Object(Smarty_Internal_Config)) #3 C:\Program Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_internal_config.php(214): Smarty_Internal_Config->compileConfigSource() #4 C:\Program Files\EasyPHP 2.0\www\tshirtshop\Presentation\templates_c\22f37aa3e6baae4e689bcbb07b27080cc078434b.file.store_front.tpl.php(23): Smarty_ in C:\Program Files\EasyPHP 2.0\www\tshirtshop\libs\smarty\sysplugins\smarty_internal_resource_file.php on line 68 |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Jun 05, 2012 7:34 pm Post subject: |
|
|
You must not set the folder properties directly, but use the setter functions as in my example.
Code: |
$this->setTemplateDir(TEMPLATE_DIR);
$this->setCompileDir(COMPILE_DIR);
$this->setConfigDir(CONFIG_DIR);
|
Anoter reasion could be that 'site.conf' is not loacted in the CONFIG_DIR folder. |
|
Back to top |
|
tunde_ajao Smarty Rookie
Joined: 23 Aug 2011 Posts: 8
|
Posted: Wed Jun 06, 2012 7:17 am Post subject: |
|
|
Thanks very much
But the error did not change
<?php
// Reference Smarty Library
require_once SMARTY_DIR .'Smarty.class.php';
/*Class that extends Smarty, used to process and display Smarty files*/
class Application extends Smarty
{
//Class constructor
public function __construct()
{
//Call Smarty's constructor
//parent::Smarty();
parent::__construct();
//Change the default template directories
/*
$this->template_dir = TEMPLATE_DIR;
$this->compile_dir = COMPILE_DIR;
$this->config_dir = CONFIG_DIR;
*/
$this->setTemplateDir(TEMPLATE_DIR);
$this->setCompileDir(COMPILE_DIR);
$this->setConfigDir(CONFIG_DIR);
}
}
?> |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Jun 06, 2012 12:56 pm Post subject: |
|
|
is there a site.conf config file? is it readable? did the smarty test install pass? |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|