|
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 |
thib3113 Smarty n00b
Joined: 22 Sep 2014 Posts: 3
|
Posted: Mon Sep 22, 2014 4:51 pm Post subject: smarty 3 and autoloader |
|
|
I have smarty 3.1.19, and i have test lot of answers for this problem, but i have everitimes errors.
I have this error :
Code: | Fatal error: Class 'Smarty_Internal_TemplateCompilerBase' not found in /var/www/EVA/classes/sysplugins/smarty_internal_smartytemplatecompiler.php on line 23 |
and my code :
Code: | function autoload($name) {
if (file_exists(ROOT.'/classes/'.$name.".class.php")) require_once(ROOT.'/classes/'.$name.".class.php");
}
spl_autoload_register("autoload"); |
and before :
Code: |
define('SMARTY_SPL_AUTOLOAD',1);
define('SMARTY_DIR','classes/'); |
i'm on Unix ( raspbian 3.12.28+ ) |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Sep 22, 2014 6:00 pm Post subject: |
|
|
Your autoloader should return false if it does not handle the request.
Code: | function autoload($name) {
if (file_exists(ROOT.'/classes/'.$name.".class.php")) {
require_once(ROOT.'/classes/'.$name.".class.php");
} else {
return false;
}
spl_autoload_register("autoload"); |
|
|
Back to top |
|
thib3113 Smarty n00b
Joined: 22 Sep 2014 Posts: 3
|
Posted: Mon Sep 22, 2014 6:44 pm Post subject: |
|
|
you have one error in your code, one } is missing.
But this code doesn't work, i have the same error .... |
|
Back to top |
|
thib3113 Smarty n00b
Joined: 22 Sep 2014 Posts: 3
|
Posted: Mon Sep 22, 2014 7:50 pm Post subject: |
|
|
i found the problem, contrary at i have found in this forum, this :
Code: | define('SMARTY_SPL_AUTOLOAD',1); |
doesn't work, BUT, if you replace by :
Code: | define('SMARTY_SPL_AUTOLOAD',false); |
it's work fine |
|
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
|