I have some issues with Zend_Controller_Router_Route. I have the following url in standard module/controller/action notation:
module: rent controller: index
params: region, town, district
filter_params are some more pagination params and drilldown stuff
I want to strip it down to: http://www.mysite.com/rent/myregion/mytown/mydistrict/filter_params/filter_values/
But these should also work
http://www.mysite.com/rent/myregion/mytown/filter_params/filter_values
http://www.mysite.com/rent/myregion/filter_params/filter_values
I tried this route
$myRoute = new Zend_Controller_Router_Route(
'rent/:region/:town/:district/*',
array(
'controller' => 'rent',
'action' => 'index'
)
);
$router->addRoute('rent', $myRoute);
This one works: http://www.mysite.com/rent/myregion/mytown/mydistrict
these ones fail
http://www.mysite.com/rent/myregion/mytown
http://www.mysite.com/rent/myregion
Action 'myregion' does not exist and was not trappend in __call()
How can I declare the other routes and what will happen to all the other params, when i have a route like http://www.mysite.com/rent/myregion/mytown/filter_params/filter_values
Thank you for your help!
It is because you added route which matches rent/:region/:town/:district/
and the two other condtions does not match this rule. You need create routes for
rent/:region/
rent/:town/
etc. You could do it but there is problem how to know that param is either town or region but it can be checked by adding regions and towns to database and looking for them or by adding some additional param and using regex.