Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

FlashDirect Not working

Hi,

I try to use flash messages and it doesn't work.

In services I have this:

// Register the flash service with custom CSS classes $di->set('flash', function () {

$flash = new FlashDirect(
    array(
        'error'   => 'alert alert-danger',
        'success' => 'alert alert-success',
        'notice'  => 'alert alert-info',
        'warning' => 'alert alert-warning'
    )
);

return $flash;

});

and in controller I have this:

$this->flash->error("Please enter a User with more than 4 characters");

and in view I have this:

<?php echo $this->flash->output(); ?>

It's something wrong here? I am new with Phalcon.

Thanks!



1.0k
Accepted
answer

Ah, I find the solution:

For FlashDirect you will need to use on View: echo $this->getContent(); For SessionFlash: $this->flashSession->output();