2012-01-02 90 views
0

我读过,我需要设置一个路径来保存URL中的值。 那是的application.ini例子表明zendframework参考指南:Zend分页器和路由

routes.example.route = articles/:articleName/:page 
routes.example.defaults.controller = articles 
routes.example.defaults.action = view 
routes.example.defaults.page = 1 
routes.example.reqs.articleName = \w+ 
routes.example.reqs.page = \d+ 

我怎么能实例化对象与上面的配置,并在我的引导使用它? 实施例:

$route = new Zend_Controller_Router_Route(
        'product/:id', 
        array(
         'module' => 'default', 
         'controller' => 'product', 
         'action' => 'detail', 
        ), 

    ); 
    $router->addRoute('product', $route); 
+1

我真的没有看到需要这种配置的paginator。无论如何,你必须要更具体才能得到答案。 – 2012-01-03 03:47:09

+0

@ aurelio-de-rosa我一直在引导程序中配置我的路线,我不会把它插入到其他地方插入路线 – dextervip 2012-01-03 16:43:07

回答

0

我想出,通过在Zend控制器路由器路由器接收到所述第二阵列PARAM是可变的要求。

$route = new Zend_Controller_Router_Route(
       'articles/:articleName/:page', 
       array(
        'module' => 'default', 
        'controller' => 'articles', 
        'action' => 'view', 
        'page' => 1 
       ), 
       array(
        'articleName' => '\w+', 
        'page' => '\d+'      
       ) 

); 
$router->addRoute('example', $route); 
+0

正是我的意思与我的评论。 – 2012-01-03 17:51:07