views:

45

answers:

1

How to change standard zend route from:

http://example.com/controller/action/param1/val1/param2/val2/...

to

http://example.com/controller/action/?param1=val1&param2=val2...
A: 

You can create your own view helper extending Zend_View_Helper_Abstract and modify it to suit your needs. Use Zend/View/Helper/Url.php as a basis for your custom view helper and just make sure you change helper's name to something other than url.

In the function:

public function url(array $urlOptions = array(), $name = null, $reset = false, $encode = true)
{
    $router = Zend_Controller_Front::getInstance()->getRouter();
    return $router->assemble($urlOptions, $name, $reset, $encode);
}

From $urlOptions, build concated string with params: ?param1=val1&param2=val2... and append it to the return value/variable...

bas