Zend Framework: route and GET settings

In my bootstrap I have

$route = new Zend_Controller_Router_Route(
    ':language/:country/:controller/:action/*', 
    array(
        'language' => 'en',
        'country' => 'us',
        'controller' => 'bicycle',
        'action' => 'index'
    ),
    array(
        'language' => '[a-z][a-z]',
        'country' => '[a-z][a-z]'
    )
);

Somewhere, in my opinion, I have

echo $this->url(array('page'=>2));
//actually this translated to $route->assemble(array('page' => 2), null, false);

The problem is when I have some GET parameters: they will not be taken into account when building the link, and this is what I really want.

Example: I am accessing a URL (in a browser)

http://localhost/myproject/en/us/controller/action/?get1=gval1&get2=gval2&get3=gval3 

and the collected URL

http://localhost/myproject/en/us/controller/action/page/2 

INSTEAD OF

http://localhost/myproject/en/us/controller/action/page/2/get1/gval1/get2/gval2/get3/gval3/ 

or (I would prefer the following)

http://localhost/myproject/en/us/controller/action/page/2/?get1=gval1&get2=gval2&get3=gval3

Any ideas?

+3
source share
1 answer

Of course, one of the solutions (with Apache) would be to call this in my opinion:

$this->url(array(page=>2)) . ($_SERVER['QUERY_STRING']?$_SERVER['QUERY_STRING']:"")

but you cannot be sure that this will always be included in the $ _SERVER variable.

+2
source

All Articles