I'm trying to convert strings to Zend Framework format URLs.
For example, I have a string list
http://example.com/products/category/books http://example.com/products/category/computers http://example.com/contact I want to receive a list with Zend_Controller_Request_Http objects, where parameters like controller, action, params, etc. will be recognized.
Zend_Controller_Request_Http Object ( ... [_params:protected] => Array ( [controller] => index [action] => products [category] => books [module] => default ) ... ) Zend_Controller_Request_Http Object ( ... [_params:protected] => Array ( [controller] => index [action] => products [category] => computers [module] => default ) ... ) Zend_Controller_Request_Http Object ( ... [_params:protected] => Array ( [controller] => index [action] => contact ... ) I found some solution here (thanks Willy Barro)
$url = 'http://example.com/module/controller/action/param1/test'; $request = new Zend_Controller_Request_Http($url); Zend_Controller_Front::getInstance()->getRouter()->route($request); $request->getParams(); and it works fine for the first url, but for the rest I receive the same parameters:
[controller]=>index, [action]=>products, [category]=>books [controller]=>index, [action]=>products, [category]=>books [controller]=>index, [action]=>contact, [category]=>books Looks like all I cannot change parameters at all...
Maybe there is some another way to convert string to the zf URL.
Thank you in advance!