Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

smarty 3 and autoloader

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
thib3113
Smarty n00b


Joined: 22 Sep 2014
Posts: 3

PostPosted: Mon Sep 22, 2014 4:51 pm    Post subject: smarty 3 and autoloader Reply with quote

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


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

PostPosted: Mon Sep 22, 2014 6:00 pm    Post subject: Reply with quote

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


Joined: 22 Sep 2014
Posts: 3

PostPosted: Mon Sep 22, 2014 6:44 pm    Post subject: Reply with quote

you have one error in your code, one } is missing.

But this code doesn't work, i have the same error ....
Back to top
View user's profile Send private message
thib3113
Smarty n00b


Joined: 22 Sep 2014
Posts: 3

PostPosted: Mon Sep 22, 2014 7:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 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