Flash Communicating Between Actions

Flash Communicating Between Actions

Here are two ways to flash a message on a view:

  1. redirectTo causes http to write a new page. You must use it to get flash to work on your next page.
    • Controller
      $this->flash['notice'] = $this->t('User was successfully updated.');
      $this->redirectTo(array('action' => 'show', 'id' => $this->user->getId()));
    • View
      <%= flash %>
  2. When a scaffold is generated, it creates view code as you see in this section. If you want Akelos to handle the navigation from the controller to the view, you must use flash_now:
    • Controller
      $this->flash_now['notice'] = $this->t($msg);
    • View
       {?flash-notice}<div class="flash_notice">{flash-notice}</div>{end}
 
flash-communicating-between-actions.txt · Last modified: 2008/09/10 21:02 by 82.103.221.224
 

The Akelos Framework was created by Bermi Ferrer and other contributors.
Potions of the code and documentation have been ported from Ruby on Rails.

The Akelos Framework is released under the LGPL license.

"Akelos", "Akelos Framework", and the Akelos logo are trademarks of Bermi Labs All rights reserved.

Wiki driven by DokuWiki