0
何Zendのルータである必要があり、最終的にそれは私がすべてのコントローラプラグインを使用することができ、次のヘルプ
http://domain.com/news/admin/edit/id/6
にルーティングこれをする???
助けてください...
何Zendのルータである必要があり、最終的にそれは私がすべてのコントローラプラグインを使用することができ、次のヘルプ
http://domain.com/news/admin/edit/id/6
にルーティングこれをする???
助けてください...
私は誰にも助けを得ていません。しかし、ついにこれを解決するコントローラー・プラグインを作成しました。誰も助けるかもしれないので、私はこれを投稿しています...
class Layzend_Controller_Plugin_AdminRouter extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$options = $bootstrap->getOption('custom');
$adminDirectory = $options['adminDirectory'];
$adminDirectory = $adminDirectory ? $adminDirectory : 'admin';
if($module == $adminDirectory)
{
$newModule = ($controller == 'index') ? 'default' : $controller;
$newController = 'admin';
$newAction = $action;
$moduleDir = APPLICATION_PATH . "/modules/$newModule";
if(!is_dir($moduleDir))
{
Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/admin/");
throw new Zend_Controller_Action_Exception('Page not found.',404);
}
$request->setModuleName($newModule);
$request->setControllerName($newController);
$request->setActionName($newAction);
}
else if($module == 'admin') {
throw new Zend_Controller_Action_Exception('Page not found.',404);
}
}
}