DooFlashMessenger


Hi guys, DooFlashMessenger is here, in this tutorial I will explain you how can you use it with just 3 lines of code. Same thing you have in class comments.

Well lets begin, we start with calling class:

1.
$flash = new DooFlashMessenger();
Now we must give access to DooFlashMessenger from view, we do that like this:

1.
DooController::view()->flashMessenger = $flash;
When we can access from view to flashMessenger we can display messages from flashMessenger, we do that with displayMesssages() method.
Here is the code you need to have in your template file:

1.
$flash->displayMessages();
Thats about it, now you just need to add some message to flash messenger, message will be stored in session, with next execution of DooFlashMessenger class messages that are stored in session will be printed with displayMessages() method. Calling displayMessages() method will echo all messages that are stored.

Adding messages to flashMessenger is done by calling method addMessage:

1.
$flash->addMessage(“This is just test message”);
That’s it if you have any questions please do ask.

Previous PostNextNext Post

Leave a Reply

Your email address will not be published.