skip to Main Content

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


  1. You output flash messages in Volt like: (without the this)

    {{ flash.output() }}
    

    And you output flash messages in PHP like:

    <?php echo $this->flash->output(); ?>
    
    Login or Signup to reply.
  2. Are you using a redirect?

    If so you need flashSession.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search