We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Proper Use of FlashDirect in controller?

I am having trouble displaying flashDirect...

In my controller i set ...

$this->flash->error('some error message');

but it does NOT display in my volt view with ...

{{ flash.output() }}

What i am doing is checking if response is POST and checking if field exisits in database. If it doesnt then I set the error and let the view kick in. I am NOT using froward because i want the view to keep all the form data the user filled out.

Questions:

  1. Do you have to use dispatcher->forward after flash (direct) for it to work? If i do that my controller would just loop forever.
  2. Is there a better way to maintain user input on custom validation errors?

flashDirect get output in {{ get_content() }}for volt or $this->getContent() in php.

flashSession get output in {{ flashSession.output() }} for volt or $this->flashSession->output() in php.

Good luck