|
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 |
Fortael Smarty Rookie
Joined: 12 Nov 2014 Posts: 8
|
Posted: Wed Nov 12, 2014 5:50 am Post subject: Bag s autoloadom |
|
|
Не могу использовать свою функцию автозагрузки.
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Nov 20, 2014 11:44 pm Post subject: |
|
|
У тебя ошибка в автозагрузчике.
Нельзя делать require - при провале попытки загрузки в одном хелпере у тебя рушится очередь автозагрузчика, а вместе с ней - вся программа. |
|
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
|