Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Fatal error: Uncaught exception 'SmartyException'

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
tunde_ajao
Smarty Rookie


Joined: 23 Aug 2011
Posts: 8

PostPosted: Tue Jun 05, 2012 11:18 am    Post subject: Fatal error: Uncaught exception 'SmartyException' Reply with quote

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

Rolling Eyes [/b]
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Jun 05, 2012 4:12 pm    Post subject: Reply with quote

I think you did extend the Smarty class.

In this case you must the PHP5 style constructor
parent::__construct();
as in the example here http://www.smarty.net/docs/en/installing.smarty.extended.tpl
Back to top
View user's profile Send private message
tunde_ajao
Smarty Rookie


Joined: 23 Aug 2011
Posts: 8

PostPosted: Tue Jun 05, 2012 7:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Jun 05, 2012 7:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
tunde_ajao
Smarty Rookie


Joined: 23 Aug 2011
Posts: 8

PostPosted: Wed Jun 06, 2012 7:17 am    Post subject: Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Jun 06, 2012 12:56 pm    Post subject: Reply with quote

is there a site.conf config file? is it readable? did the smarty test install pass?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP