Try using in your view, just the follow: {{ content() }}
Edit
Forget the flashSession in this case. If you can't create an alert above all your forms:
// In controller
if($this->request->getPost('button1')) {// or just _POST
$this->view->setVar('error1', "You have clicket at button 1");
}
if($this->request->getPost('button2')) {
$this->view->setVar('error2', "You have clicket at button 2");
}
// In view
<form>
<button name="button1"><?php $flash->outputMessage('error', $error1); ?></button>
<button name="button2"><?php $flash->outputMessage('error', $error2); ?></button>
</form>
Here is how like to use. But I don't see any problem to do that in your case:
// In services:
$di->set('flash', function () {
$flash = new FlashDirect( // wherever your classes are, here using bootstrap
array(
'error' => 'alert alert-danger bold',
'success' => 'alert alert-success bold',
'notice' => 'alert alert-info bold',
'warning' => 'alert alert-warning bold'
)
);
return $flash;
});
// in controller
$this->flash->error("THere is something wrong");
$this->flash->success("Nice, it's correct!");
// in view
{{ content() }}
<form name="1"></form>
<form name="2"></form>