Monday, February 27, 2012

CakePHP 2.1RC: How to set a custom layout when using ExceptionRenderer

I'm trying to override default behavior of CakePHP when someone hits
URLs like http://localhost/SOMETHING_NOT_VALID

I added a subclass of ExceptionRenderer and added a
missingController() method. That plumbing all works fine and dandy. If
I do an echo(), the output comes out just fine. However, I have two
questions:

How can I use a custom layout? In my missingController() method, I
played with setting $this->controller->layout, but nothing happened.
I noticed a 200 gets returned now. I still want to have a 404
returned. How can I keep it so that a 404 gets returned?
Thanks in advance! :)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: