Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.

Post Page Advertisement [Top]

CakePHP Redirection

$this->redirect(array('controller' => 'orders', 'action' => 'thanks'));
Redirecting to website:
Render the element for ajax:
Redirect to 404 not found:
throw new NotFoundException('404 Error - Page not found');

If you need to redirect to the referer page you can use:

If you need to redirect to the edit page with id:
$this->redirect(array(’action’ => ’edit’, $id));

Redirect to different action:

Call element in controller action

$this->viewPath = 'Elements';

No comments:

Post a Comment

Bottom Ad [Post Page]