2

I am trying to develop an application using zend framework (v 1.11). Am totally new to this framework.

I have a URL like this.

http://xyz.local/client/feedback/index/username/abc/page/2

The above link points to client module, feedback controller's index action.

url parameter username along with a valid value is necessary for every request.

On this page I have paginated all the feedbacks. My probem is that when I navigate away from the index action to some other action in same or different controller the parameter name /page/2 still remains in the url.

For suppose if I navigate to new action of same controller then the new URL appears like this

http://xyz.local/client/feedback/new/username/newClient/page/2

whereas it should have been like this

http://xyz.local/client/feedback/new/username/newClient

Using the $this->url(array('module' => 'client', 'controller' => 'feedback', 'action' => 'new'), null, true) resets all the parameters including the username, which I do not want.

What's the standard Zend's way of doing this.

2
  • 1
    You could pass the username to the view and add it to the url's parameters: $this->url(array('module' => 'client', 'controller' => 'feedback', 'action' => 'new', 'username' => $username), null, true) or you just set the page-parameter to null and omit the final argument when calling the URL-ViewHelper. I think the former is the cleaner way... Commented Oct 3, 2012 at 7:30
  • cool, that worked (former approach).. thanks. :) Can you please post that reply as an answer to this question.? Commented Oct 3, 2012 at 7:50

1 Answer 1

5

You can pass the username to the view and add it to the url's parameters in the URL-ViewHelper:

$this->url(array('module' => 'client', 'controller' => 'feedback', 'action' => 'new', 'username' => $username), null, true)
Sign up to request clarification or add additional context in comments.

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.