$this->redirect(array('action'=>'index'));
It's okay for a small application, but when things start to get larger, like in a CMS, you'll find that the return path can be a little unexpected. To make everything more predictable, I now write this in the action method to which I want to return:
$this->Session->write('LastAdminPage', DS.$this->params['url']['url']);
And this wherever I need to make the return, like in a CRUD method on the controller or on a cancel button in the view:
$this->redirect($this->Session->read('LastAdminPage'));
No comments:
Post a Comment