Print message on next page

Asked

Viewed 59 times

1

How do I print a message when opening a page, for example:

I’m on the page Cliente/View and when redirected to the page Nfe/index, I want to print a message with instructions on what should be done, pulling some data from the Cliente/View.

I tried to use the

$this->Session->setFlash('mensagem');

But I continued without results, only displayed the message when I return to the page Cliente/View again.

1 answer

0

For the same case, the following reply helped me, see her below:

When using the setFlash, you can provide a key value, for example:

$this->Session->setFlash('This message is for form 1.', 'default', array(), 'form1');

Then you can print the flash above each form. It will only be displayed if the specified key has a value.

<?php echo $this->Session->flash('form1') ?>

For more information see Creating a Notification Message.

  • Dude I tested it here and it only works if it has it in it controller, if the View is in controller different, this does not work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.