I believe that is exactly what I wanted now that you lay it out like that.

Thanks for dumbing it down for me.  I think I was missing how to get it into the view.

I will test this out in my app and procede to remove my code bloat that I previously posted.

Thanks again.

On 5/22/06, stephenrs <[EMAIL PROTECTED]> wrote:

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.


Reply via email to