脚本宝典收集整理的这篇文章主要介绍了php – Zend Framework中的动态默认模块,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
admin blog calendar
作为可以加载的模块.如果我将’bLOG’作为默认模块,则’admin’和’calendar’必须将其控制器命名为(Admin_IndexController,Calendar_IndexController),而’blog’不是(IndexController).
如果我将’calendar’更改为默认模块,由于命名空间,ZF无法再找到类.
$modules = new Modules(); $activeModules = $modules->fetchActive(); foreach($activeModules as $mod) { $loadedModules[$mod->name] = '..application/modules/' . $mod->name . '/controllers'; if($mod->default) { $defaultModule = $mod->name; } } $frontController->setControllerDirectory($loadedModules); $frontController->setDefaultModule($defaultModule);
首先更改“博客”模块以使用命名空间:
<?PHP // Used to be "class IndexController" class Blog_IndexController extends Zend_Controller_Action { }
然后,在Zend_Controller_Front实例上调用setParam for PRefixDefaultModule选项:
<?PHP // Allow your default module to be prefixed $frontController->setParam('prefixDefaultModule',true);
有关说明,请参阅bug # 1831.
以上是脚本宝典为你收集整理的php – Zend Framework中的动态默认模块全部内容,希望文章能够帮你解决php – Zend Framework中的动态默认模块所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。