0

I want to send parameter from action to view which is not it's view, since each action has it's .phtml view . I want to redirect to index.phtml page when I am in editAction

inside the edit action I make

$this->_helper->redirector->gotoRoute(array('module' => 'visits', 'controller' => 'visit', 'action' => 'index'), 'visit');

so I can't use like this in the controller action

$this->message="Successfully saved"; 

I search in google I found that I can use

$this->getRequest()->setParam('message',"Successfully saved");

but How can I get the param in .PHTML page

1
  • Can you be more specific on what your "view which is not it's view" is? Where and how do you render this other view? Commented Apr 2, 2012 at 10:37

1 Answer 1

1

you may use flash messenger , its capable to do such these tasks

FlashMessenger is a helper that allows you to store messages between requests. The most common use I have for it is for a "saved" message after doing an edit of an item that then redirects back to a list.

examples :

http://akrabat.com/zend-framework/zend-frameworks-flash-messenger-action-helper/

Sign up to request clarification or add additional context in comments.

6 Comments

When I make echo $this->_helper->flashMessenger->getMessages(); in the index page, this error occur Notice: Trying to get property of non-object
check this basic example : framework.zend.com/manual/en/…
Don't do this $this->view->messages = $this->_helper->flashMessenger->getMessages(); in a view, but in an action! From your view, echo $this->messages. Of course, you can't get the message if you're still in the same request, you need to redirect first.
@liyali, The point is I want to redirect to another view, when I make $this->view this mean the action view where as I redirect to another view.
Another explanation for the solution here stackoverflow.com/questions/8400000/…
|

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.