Zend Route Regex and advanced options

I want to use a URL like this:

site.com/car-list/param1/value1/param2/value2

"car" is variable and can be anything. I solved the site.com/car-list part as follows:

$categoryRoute = new Zend_Controller_Router_Route_Regex( '(\b.+\-list\b)', array( 'module' => 'default', 'controller' => 'search', 'action' => 'index' ), array( 1 => 'productType' ) ); 

I can get the "car-list" when I need the productType parameter. But I can not get the rest of the url with $ this β†’ _ getParam () in the controller.

How can i do this? thanks.

+4
source share
1 answer

Well, I don’t see how to do this with Router_Route_Regex, but with Router_Route it would be easier (I thought I replaced "-" with "/")

 $categoryRoute = new Zend_Controller_Router_Route ':car/list/*', array( 'module' => 'default', 'controller' => 'search', 'action' => 'index' ) ); 
Magic

happens because of the "/ *" at the end of the line .: a car variable can be obtained with $ request-> getParam ('car');

+5
source

Source: https://habr.com/ru/post/1333505/


All Articles