Monday 29 June 2015

How to create a custom error page

In Cakephp we have some default error pages but we can create our own error page. Here we will create a custom error page to show error if controller not found. If controller not found then we will show 404 error page. Below are few steps for creating custom error page First create a error.ctp file for layout if you want to show error page with different UI Open appController.php under /app/Controller and add the below code
  1. function beforeRender() {
  2. $this->setErrorLayout();
  3. }
  4. function setErrorLayout() {
  5. if ($this->name == 'CakeError') {
  6. $this->layout = 'error';
  7. }
  8. }
- See more at: http://findnerd.com/list/view/How-to-create-a-custom-error-page/3470/
For any issue about PHP Programming Questions and Answers you can Visit to our PHP Developer Forum

No comments:

Post a Comment