I use to declare my routes on the application.ini, so I'm not sure, but 
something like this may work:
 
===============================
$default = new 
Zend_Controller_Router_Route(':language/:module/:controller/:action', array(
    'language' => 'es',
    'module' => 'public',
    'controller' => 'index',
    'action' => 'index'
 )
);

$admin = new Zend_Controller_Router_Route('/admin/:controller/:action/*', array(
    'module' => 'admin',
    'controller' => 'index',
    'action' => 'index'
 ),
);
 
$router->addRoute('default', $default);
$router->addRoute('admin', $admin);
===============================

----- Mensaje original -----
> I am developing a multilanguage app with two modules (admin and
> public). I
> wanna use this structure domain.com/language/module/controller/action.
> The
> thing is that it works for the public module but Also it works for
> admin
> module. This is my bootstrap:
> 
> 
> 
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
> 
> protected function _initAutoload() {
> 
> $this->bootstrap('frontController');
> $this->_front = $this->getResource('frontController');
> 
> $autoLoader = new Zend_Loader_Autoloader_Resource(array(
> 'basePath' => APPLICATION_PATH,
> 'namespace' => '',
> 'resourceTypes' => array(
> 'form' => array(
> 'path' => 'admin/forms/',
> 'namespace' => 'Admin_Form_',
> ),
> 'model' => array(
> 'path' => 'models/',
> 'namespace' => 'Model_'
> )
> )
> ));
> 
> $autoLoader_ = new Zend_Application_Module_Autoloader(array(
> 'basePath' => APPLICATION_PATH . '/public/',
> 'namespace' => 'Public_',
> 'resourceTypes' => array(
> 'forms' => array(
> 'path' => 'forms/',
> 'namespace' => 'Public_Form_'
> )
> )
> ));
> 
> return $autoLoader;
> }
> 
> protected function _initConfig() {
> $config = new Zend_Config_Xml(BASE_PATH . '/config.xml',
> APPLICATION_ENV);
> $registry = Zend_Registry::getInstance();
> $registry->set('config', $config);
> return $config;
> }
> 
> protected function _initDb() {
> $this->bootstrap('config');
> $config = $this->getResource('config');
> $db = Zend_Db::factory($config->database->adapter,
> $config->database);
> $db->setFetchMode(Zend_Db::FETCH_OBJ);
> $db->query("SET NAMES 'utf8';");
> $db->query("SET CHARACTER SET 'utf8';");
> Zend_Db_Table::setDefaultAdapter($db);
> return $db;
> }
> 
> protected function _initRoutes() {
> $router = $this->_front->getRouter();
> $router->removeDefaultRoutes();
> 
> $language = new Zend_Controller_Router_Route(':language',
> array('language' => 'es'));
> 
> $module = new Zend_Controller_Router_Route_Module(
> array(
> 'module' => 'public',
> 'controller' => 'index',
> 'action' => 'index'
> ),
> $this->_front->getDispatcher(),
> $this->_front->getRequest()
> );
> 
> $module->isAbstract(true);
> 
> $default = new Zend_Controller_Router_Route_Chain();
> $default->chain($language);
> $default->chain($module);
> $router->addRoute('default', $default);
> 
> }
> 
> protected function _initView() {
> $view = new Zend_View();
> 
> $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
> $viewRenderer->setView($view);
> 
> $view = Pandora_View_Helpers::add($view);
> 
> return $view;
> }
> 
> protected function _initControllers() {
> $this->_front->addControllerDirectory(APPLICATION_PATH .
> '/admin/controllers', 'admin');
> $this->_front->addControllerDirectory(APPLICATION_PATH .
> '/public/controllers', 'public');
> }
> 
> }
> 
> How can I it works just for the first module (public)?
> 
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Working-with-multilanguage-routers-in-Zend-tp3589785p3589785.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]

-- 
Alayn Gortazar
Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com
+34 94.404.81.82

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to