开发者

Zend Route, change action with no change params

1: I need to change this link (action index)

local:8080/default/acc/index/PageDate/2011-05-01/ServerId/1/

to other (action catch)

local:8080/default/acc/catch/PageDate/2011-05-01/ServerId/1/

2: I need to set default params, to various variables. For example I wont to use this links

local:8080/default/acc/catch/PageDate/2011-05-01/ServerId/1/

or

local:8080/default/acc/catch/PageDate/2011-05-01/

or

local:8080/default/acc/catch/ServerId/1/

like this

$route =  new Zend_Controller_Router_Route_Regex(
            'default/accountant/index ???',
            array(
                  'module' => 'default',
                  'controller' => 'acc',
                  'action' => 'catch',
                  'ServerId' => 0,
                  'PageD开发者_C百科ate' => '2011-01-01', // and  many others
            )
            ,array(

            )
            ,'default/acc/index/'
        );

But I dont know how to do it.


To forward index action to catch action, use _forward method inside index action.

For matching multiple URLs mentioned in point 2, do not use any routers at all. Zend routes those automatically to appropriate controllers and actions with the parameter values too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜