За последние 24 часа нас посетили 56867 программистов и 1750 роботов. Сейчас ищут 850 программистов ...

Zend разные модули для разных boorstrap

Тема в разделе "Прочие вопросы по PHP", создана пользователем mihal4encko.sasha, 25 ноя 2015.

  1. mihal4encko.sasha

    mihal4encko.sasha Новичок

    С нами с:
    18 ноя 2015
    Сообщения:
    8
    Симпатии:
    0
    Добрый день. В Zend все файлы boorstrap в приложении работают для всего сайта. Мне нужно что бы для модуля работал только boorstrap в модуле. У меня есть модуль admin, который видит bootstrap соседнего модуля user и в итоге в admin не правильный роутинг. В файле Modules у меня есть функция, которая подключает boorstrap:
    Код (PHP):
    1.  public function init()
    2.     {
    3.        
    4.  
    5.  
    6.         $bootstraps = array();
    7.         $bootstrap = $this->getBootstrap();
    8.         $bootstrap->bootstrap('FrontController');
    9.         $front = $bootstrap->getResource('FrontController');
    10.  
    11.         $modules = $front->getControllerDirectory();
    12.         $default = $front->getDefaultModule();
    13.         $curBootstrapClass = get_class($bootstrap);
    14.         foreach ($modules as $module => $moduleDirectory) {
    15.             $bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap';
    16.             if (!class_exists($bootstrapClass, false)) {
    17.                 $bootstrapPath  = dirname($moduleDirectory) . '/Bootstrap.php';
    18.                 if (file_exists($bootstrapPath)) {
    19.                     $eMsgTpl = 'Bootstrap file found for module "%s" but bootstrap class "%s" not found';
    20.                     include_once $bootstrapPath;
    21.                     if (($default != $module)
    22.                         && !class_exists($bootstrapClass, false)
    23.                     ) {
    24.                         throw new Zend_Application_Resource_Exception(sprintf(
    25.                             $eMsgTpl, $module, $bootstrapClass
    26.                         ));
    27.                     } elseif ($default == $module) {
    28.                         if (!class_exists($bootstrapClass, false)) {
    29.                             $bootstrapClass = 'Bootstrap';
    30.                             if (!class_exists($bootstrapClass, false)) {
    31.                                 throw new Zend_Application_Resource_Exception(sprintf(
    32.                                     $eMsgTpl, $module, $bootstrapClass
    33.                                 ));
    34.                             }
    35.                         }
    36.                     }
    37.                 } else {
    38.                     continue;
    39.                 }
    40.             }
    41.  
    42.             if ($bootstrapClass == $curBootstrapClass) {
    43.                 // If the found bootstrap class matches the one calling this
    44.                 // resource, don't re-execute.
    45.                 continue;
    46.             }
    47.  
    48.             $bootstraps[$module] = $bootstrapClass;
    49.         }
    50.  
    51.         return $this->_bootstraps = $this->bootstrapBootstraps($bootstraps);
    52.     } 
    Добавлено спустя 1 минуту 32 секунды:
    Эта функция почему-то не работает правильно, помогите пожайлуста

    PHP, JavaScript, SQL и другой код пишите внутри тегов
    Код ( (Unknown Language)):
    1. [b]php][/b]Тут код[b][/[/b][b]code][/b][/color]