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.

how to show a html page after Phalcon\Flash\Direct show the success message with a specific time

when I use the Phalcon\Flash\Direct to show a success message, just like

$this->flash->success("The post was correctly saved!");
return $this->dispatcher->forward(array("action" => "index"));

my question is, how to forward to the index action automatically after a specific time, for example in 2 seconds?

thanks



18.0k
Accepted
answer
edited Dec '14

Hmmm, if what you mean is the users notice "The post was correctly saved!" , and after 2 second the page is redirected to index, you need a javascript in the client side to redirect the page.

Or , it would be simpler if you reserve some space in the top of index, set the flash in your transaction action, and directly redirect to index:

<!-- app/views/contact/index.phtml -->

<body>
<section id="notification">
    <?php $this->flashSession->output() ?>
</section>
....
</body>