I can't send view message if use redirect.

now. I use.

  1. $messages = array(
  2. 'error' =>'error',
  3. 'username' =>null,
  4. 'password' =>null,
  5. 'ConfirmPassword'=>null,
  6. 'email' =>null,
  7. );
  8. $this->view->validation = $messages;
  9. $this->flash->error = true;

    return $this->dispatcher->forward(array( 'controller' => 'admin', 'action' => 'adminMCreate' ));

Then forward to view validation value show on view file.

But.Then i use.

  1. $messages = array(
  2. 'error' =>'error',
  3. 'username' =>null,
  4. 'password' =>null,
  5. 'ConfirmPassword'=>null,
  6. 'email' =>null,
  7. );
  8. $this->view->validation = $messages;
  9. $this->flash->error = true;

    $this->response->redirect('admin/adminManage');

  10. $this->view->disable();

Then redirect to view validation value ( not ) show on view file. I use redirect because it change URL to adminManage .but forward not change to adminManage

another question - Then i use redirect if view have table, table not update i fix the problem by click refresh button. but it don't work

Sorry for my English Thank you.

edited Aug '15

forward -> flash

redirect -> flashSession



301

forward -> flash

redirect -> flashSession

thank you. but it not show then redirect and then forward flash show.

if i use forward flash and view show value all.But url not change.

if i use redirect flash and view not show all.But url change.

Please check the docs before posting questions, your semantics is way off.

Direct flash messages won't work with redirect, because it generates a new Response. To flash a direct message, you also have to output content() in the corresponding view file.

// SomeController.php
public function errorAction() {
   $this->flash->error('Your message goes here');
}
// some/error.volt
{{ content() }}

Using redirect, you will have to do something like this:

// SomeController.php
public function errorAction() {
   $this->flashSession->error('Your message goes here');
   $this->response->redirect('whatever/url');
}
// whatever/url.volt
{{ flashSession.output() }}