I want to use a URL like this:
site.com/car-list/param1/value1/param2/value2
"car" is variable and can be anytihng. i solved the "site.com/car-list" part like this:
$categoryRoute = new Zend_Controller_Router_Route_Regex(
'(\b.+\-list\b)',
array(
'module' => 'default',
'controller' => 'search',
'action' => 'index'
),
array(
1 => 'productType'
)
);
I can get "car-list" when i wa开发者_运维技巧nt "productType" param. But i cant get rest of the url with $this->_getParam() in controller.
how can i do this? thanks.
Well, i don't see how to make it with Router_Route_Regex, but with Router_Route it would be easier (thought, i replace "-" with "/")
$categoryRoute = new Zend_Controller_Router_Route
':car/list/*',
array(
'module' => 'default',
'controller' => 'search',
'action' => 'index'
)
);
magic happens due to the "/*" at the end of the string. :car variable can be got with $request->getParam('car');
精彩评论