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:
$flash = new DooFlashMessenger();
Now we must give access to DooFlashMessenger from view, we do that like this:
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:
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:
$flash->addMessage(“This is just test message”);
That’s it if you have any questions please do ask.