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

Bag s autoloadom

 
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 -> Language: Russian
View previous topic :: View next topic  
Author Message
Fortael
Smarty Rookie


Joined: 12 Nov 2014
Posts: 8

PostPosted: Wed Nov 12, 2014 5:50 am    Post subject: Bag s autoloadom Reply with quote

Не могу использовать свою функцию автозагрузки.
Code:
function do_load($name) {
    $file = '/'.APP.'helper/'.$name.'.php';
    require $file;
}

spl_autoload_register('do_load');

Есть хэлпер, который загружает смарти. Сами хэлперы загружаются "на лету". Я не пойму природы ошибки, но думаю, что этот автолоадер пытается загружать какой-то кусок смарти
Code:
Warning: require(app/helper/Smarty_Internal_TemplateCompilerBase.php) [function.require]: failed to open stream: No such file or directory in Z:\home\domain.com\www\index.php on line 75

Fatal error: require() [function.require]: Failed opening required 'app/helper/Smarty_Internal_TemplateCompilerBase.php' (include_path='.;C:\php\pear') in Z:\home\domain.com\www\index.php on line 75

Дело в том, что в папке helper нет в помине никаких элементов смарти. В контроллере происходит так:
Code:
call::smarty();
$this->smarty->display(...)

Возможно проблема в том, что автолоадер находится в index.php , а не главном контроллере.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Nov 20, 2014 11:44 pm    Post subject: Reply with quote

У тебя ошибка в автозагрузчике.
Нельзя делать require - при провале попытки загрузки в одном хелпере у тебя рушится очередь автозагрузчика, а вместе с ней - вся программа.
Back to top
View user's profile Send private message
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 -> Language: Russian 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