FlashMessenger

4 messages Options
Embed this post
Permalink
Abraham Block

FlashMessenger

Reply Threaded More More options
Print post
Permalink
This is something that i've done a million times without fail outside this framework, and the framework looks like it has an easy API to use such a feature.
Having said that, someone please point out the errors of my ways....

I have a controller that looks something like this....

class MyController
{

       
    public function init()
    {
    $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
    $this->_redirector = $this->_helper->getHelper('Redirector');

....snip....

    }

    public function openAction() {
   
     ....snip...
   
    $this->_flashMessenger->addMessage('Event Opened');
        $this->_redirector->gotoUrl($this->view->url(array(), 'admin.list_events'));

      ....snip....
    }
   
     public function listAction() {
    $this->view->messages = $this->_flashMessenger->getMessages();
   
    print_r($_SESSION);
    }

I'm using the stable version of 1.6.1....

I don't see my message and I don't even see it in the $_SESSION superglobal....

If there's anymore information needed, please let me know...
Ralph Schindler-2

Re: FlashMessenger

Reply Threaded More More options
Print post
Permalink
Do have any other requests coming through at the same time by chance?
Perhaps you have a broken link pulling a 404, or you have ajax happening at
the same time.  Effectively, you need to make sure that you are not
"Expending" an extra hop during the redirect.

Does that make sense?
-ralph


On 10/3/08 4:05 PM, "Avi Block" <[hidden email]> wrote:

>
> This is something that i've done a million times without fail outside this
> framework, and the framework looks like it has an easy API to use such a
> feature.
> Having said that, someone please point out the errors of my ways....
>
> I have a controller that looks something like this....
>
> class MyController
> {
>
>
>     public function init()
>     {
> $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
> $this->_redirector = $this->_helper->getHelper('Redirector');
>
> ....snip....
>
>     }
>
>     public function openAction() {
>
>      ....snip...
>
> $this->_flashMessenger->addMessage('Event Opened');
> $this->_redirector->gotoUrl($this->view->url(array(),
> 'admin.list_events'));
>
>       ....snip....
>     }
>    
>      public function listAction() {
> $this->view->messages = $this->_flashMessenger->getMessages();
>
> print_r($_SESSION);
>     }
>
> I'm using the stable version of 1.6.1....
>
> I don't see my message and I don't even see it in the $_SESSION
> superglobal....
>
> If there's anymore information needed, please let me know...

--
Ralph Schindler
Software Engineer     | [hidden email]
Zend Framework        | http://framework.zend.com/


CatharsisJelly

Re: FlashMessenger

Reply Threaded More More options
Print post
Permalink
In reply to this post by Abraham Block
I have a similar issue at the moment, did you find the solution for this?
CatharsisJelly

Re: FlashMessenger

Reply Threaded More More options
Print post
Permalink
CatharsisJelly wrote:
I have a similar issue at the moment, did you find the solution for this?
Actually, forget that I found my problem I was putting something into a different namespace. e.g.
$this->_flashMessenger->setNamespace( 'error' );                
$this->_flashMessenger->addMessage( 'Details not found, please check the username and password.' );
$this->_flashMessenger->resetNamespace();
Then trying to iterate through all the messages in the view by using
foreach $this->messeges->getMessages() as $msg
Of course this only pulled messages out from the default namespace. Change namespace in the view and hey presto.