No lo he probado pero podrías hacer algo así:
Un dispatcher (library/My/Dispatcher/Custom.php):
Código PHP:
Ver original<?php
class My_Dispatcher_Custom extends Zend_Controller_Dispatcher_Standard
{
public function resetControllerDirectory()
{
$this->_controllerDirectory
= array(); }
}
Bootstrap:
Código PHP:
Ver original<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public function _initPlugin()
{
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$sModuleDir = $this->getOption('mainModuleDirectory');
$front->registerPlugin(new Application_Plugin_SubModules($sModuleDir));
$front->setDispatcher(new My_Dispatcher_Custom());
}
public function _initRoutes()
{
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$router = $front->getRouter();
$router->removeDefaultRoutes();
$router->addRoute(
'default',
new Zend_Router_Route(
':mainmodule/:module/:controller/:action/*',
'mainmodule' => 'default',
'module' => 'default',
'controller' => 'index',
'action' => 'index'
)
)
);
}
}
Un plugin (application/plugins/SubModules.php):
Código PHP:
Ver original<?php
class Application_Plugin_SubModules extends Zend_Controller_Plugin_Abstract
{
$this->_modulesDirectory = '';
public function __construct($modulesDirectory)
{
$this->_modulesDirectory = $modulesDirectory;
}
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
$sModule = $request->getParam('mainmodule');
$Front = Zend_Controller_Front::getInstance();
$Front->getDispatcher()->resetControllerDirectory();
$sModule = 'default';
}
$Front->addModuleDirectory($this->_modulesDirectory . DIRECTORY_SEPARATOR . $sModule);
}
}
En tu application.ini:
Código:
mainModuleDirectory = APPLICATION_PATH "/generalmodules"
y dentro de generalmodules pones tu module1, module2, default, etc.
Saludos.