The solutiion was really alluded to in AD7six's first post on this
thread, but I'll try to lay ouot more clearly how I've done this.
Assuming you're adding Posts, you need something like this in the add()
method of your controller:
function add()
{
if ($this->Post->save($this->params['data']))
{
$this->Session->setFlash('The post has been saved', 'default');
$this->redirect('posts/add');
}
}
This will store the message in the session for later retrieval in your
layout (named 'default' in this example.
So, somewhere in your default.thtml layout put this code:
<?
php if (isset($this->controller->Session))
$this->controller->Session->flash();
?>
This will display the message stored in the session by the controller
above, and then show the contents of your "add" view (add.thtml) -
because we redirected to 'posts/add' above.
No extra functions or session variables, and no flash screen in between
steps. It just saves the Post and then shows a new empty Post form,
with the status message displayed on the same page. I know this works
because I've released it to QA testing for a client's internal admin
tool.
I hope I've understood what the original question was on this thread,
and I hope this helps.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---