1

I tried to create a new custom handler in cakephp . It was not working for me. I need to show custom messages to the user when he tries to access the url which are not accessible/restricted to him. Right now cake showing Internal Server Error, but I need to show custom messages with his accessible page link. I need to throw an exception in /Lib/...php

Thank you in advance.

1 Answer 1

2

You can create a custom exception handler in cakephp 2.x see this link

http://book.cakephp.org/2.0/en/development/exceptions.html#create-your-own-exception-handler-with-exception-handler

http://book.cakephp.org/2.0/en/development/exceptions.html#using-a-custom-renderer-with-exception-renderer-to-handle-application-exceptions

You can change layout in beforeRender() of AppController

public function beforeRender(){
  if($this->name == 'CakeError'){
      $this->layout = 'error';
   }        
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.