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:01 by 82.103.221.224