1

I have a url that looks like this:

/controller/action?query=foobar

In my paginator view script, I am calling the URL view helper to add the page number to the url:

<a href="<?php echo $this->url(array('page' => $this->next), null, false); ?>">

Passing false should make it so that the URL is not reset, but the URL being generated does not include the original query parameter:

/controller/action/page/2

...and it should be:

/controller/action/page/2?query=foobar

What am I doing wrong?

2 Answers 2

3

You will have to add the query string to the end of the URL that is created by the Helper. The helper's job is to create links based on defined routes. It will not maintain query strings because no route in Zend has a query string.

<a href="<?php echo $this->url(array('page' => $this->next), null, false); ?>?<?php echo $_SERVER['QUERY_STRING'];?>">
Sign up to request clarification or add additional context in comments.

Comments

0

You'd better use the following format of the URL:

/controller/action/query/foobar

That should be compatible with the URL helper non-reset functionality and your code should work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.