I'm using Phalcon 2.0.6 (win7) with multiple inheritance templates
How can I display the flash messages?
This doesn't work
// service
use Phalcon\Flash\Direct as Flash;
use Phalcon\Flash\Session as FlashSession;
$di->setShared("session", function () {
$session = new SessionAdapter();
$session->start();
return $session;
});
$di->set("flash", function () {
$flash = new Flash();
$flash->setImplicitFlush(false);
return $flash;
});
$di->set("flashSession", function () {
$flashSession = new FlashSession();
$flashSession->setImplicitFlush(false);
return $flashSession;
});
// controller
$this->flashSession->error('Flash Error!!!');
$this->flash->error('Direct Error!!!');
//$this->flashSession()->getMessages(); //works, return an array with messages
<h1>Main layout</h1>
{# {{ flashSession.getMessages() }} return null #}
{{ flash.output() }}
{{ flashSession.output() }}
{% block content %}
{% endblock %}
I have looked a lot of topics and issues but I did not found the solution.