Zend_Controller_Router_Route_Chain more routes - more problems

Posted by epmspec on Stack Overflow See other posts from Stack Overflow or by epmspec
Published on 2010-06-08T17:09:58Z Indexed on 2010/06/08 17:12 UTC
Read the original article Hit count: 160

Filed under:
|
|

When i use only langRoute and moduleRoute i have not any problems. But when i add pageRoute it is not work properly. I have tried many another ways do it (Regex etc) but none gives the desired result. Can anybody help me?

$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();

//Route_page needs dispatcher and request
$dispatcher = $front->getDispatcher();
$request = $front->getRequest();

// Add languag routes
$langRoute = new Zend_Controller_Router_Route_Hostname(
  ':language.domain.com',
  array(
    'language' => 'ru',
  ),
  array(
    'language' => '^(ru|en)$',
  )
);

// Add module routes
$moduleRoute = new Zend_Controller_Router_Route_Module(array(),$dispatcher,$request);

// Add page routes
$pageRoute = new Zend_Controller_Router_Route(
  ':uri\.html',
  array(
    'controller' => 'index',
    'module' => 'default',
    'action' => 'index',
    'uri' => 'index',
  ),
  array ('uri' => '[0-9a-z\-]+')
);

// Add chain routes
$chainedRoute = new Zend_Controller_Router_Route_Chain();
$chainedRoute->chain($pageRoute);
$chainedRoute->chain($langRoute)->chain($moduleRoute);
$router->addRoute('default', $chainedRoute);

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about routing