I’m using twig as the template engine, works good, but I’m having an issue outputing the flash messages there. none of these show anything.
{{ this.flash.output() }}
Only {{ content }}
works, but it outputs notice and php warning messages as well.
This is how I set the flash
$di->set('flash', function () {
$flash = new FlashDirect([
//tie in with twitter bootstrap classes
'error' => 'alert alert-danger',
'success' => 'alert alert-success',
'notice' => 'alert alert-info',
'warning' => 'alert alert-warning'
]);
return $flash;
});
This how I pass the messages to flash
$this->flash->error('Please use the link sent to you by email');
Any help would be appreciated.
2
Answers
You output flash messages in Volt like: (without the
this
)And you output flash messages in PHP like:
Are you using a redirect?
If so you need flashSession.