On Sat, Jan 11, 2014 at 5:42 AM, Kenroy Bennett <[email protected]> wrote:
> I am creating some links in a view with the asistance of the url
> view helper and I would like to get items from the query string used in the
> request in the page to so i can add them to the links i am creating.
> How can i get access to the querystring in the view that was used during
> the request?
The url() helper takes several arguments. The first is the route, the
second the parameters/replacements you want to use. The third argument
are _options_ to pass to the route instance, and this is the one you
want. Pass the following to it:
array('query' => true)
and the link generated will re-use any query string parameters made in
the request. (You can also specify an assoc array, in which case only
the values you specify will be used.)
So, as an example:
echo $this->url('foo', array('id' => $id), array('query' => true));
or, using PHP 5.4 and up:
echo $this->url('foo', ['id' => $id], ['query' => true]);
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]