コード例 #1
0
ファイル: Friendlyurls.php プロジェクト: Cryde/sydney-core
 /**
  * Sets all the default routes for processing the friendly URLs
  *
  * @param Zend_Controller_Router_Interface $router
  */
 public static function setDefaultRoutes(Zend_Controller_Router_Interface $router)
 {
     $internalUrl = 'sydney\\/|publicms|admin|default\\/';
     // routeName => array( route, defaults, map, reverse )
     $routesRegex = array('searchRoute' => array('search\\.html', array('module' => 'publicms', 'controller' => 'search', 'action' => 'index'), null, 'search.html'), 'fileRoute' => array('(.*)FILE-([0-9]*)', array('module' => 'publicms', 'controller' => 'file', 'action' => 'getrfile'), array(1 => 'slug', 2 => 'id'), '%sFILE-%s%s'), 'filedisplayedRoute' => array('sydney\\/img\\/([0-9]{1,4})-([0-9]{1,10})\\.(png|jpg|gif)', array('module' => 'publicms', 'controller' => 'file', 'action' => 'showimg'), array(1 => 'dw', 2 => 'id', 3 => 'ext'), 'sydney/img/%s-%s.%s'), 'pageRoute' => array('^((?!' . $internalUrl . ').*)$', array('module' => 'publicms', 'controller' => 'index', 'action' => 'view'), array(1 => 'slug'), '%s'));
     foreach ($routesRegex as $k => $v) {
         $router->addRoute($k, new Zend_Controller_Router_Route_Regex($v[0], $v[1], $v[2], $v[3]));
     }
     $router->addRoute('sydneydefault', new Zend_Controller_Router_Route('', array('module' => 'publicms', 'controller' => 'index', 'action' => 'view')));
 }
コード例 #2
0
ファイル: Router.php プロジェクト: ronseigel/agent-ohm
 public function addRoutes(Zend_Controller_Router_Interface $router)
 {
     $frontName = $this->_config->getName();
     $routeMatch = $frontName . '/:controller/:action/*';
     $moduleName = (string) $this->_config->module;
     $routeParams = array('module' => $moduleName, 'controller' => 'index', 'action' => 'index', '_frontName' => $frontName);
     $route = new Zend_Controller_Router_Route($routeMatch, $routeParams);
     $router->addRoute($moduleName, $route);
     return $this;
 }