Friday, June 22, 2012

Re: How get Exception Handler to use plugin layout?

Majna, thanks for the tip. That inspired me to think about it a bit more and I figured it was simpler and cleaner to set the layout in bootstrap.php where the plugin is loaded. That is working well.

Thanks

Mark

On Friday, June 22, 2012 2:24:36 PM UTC-4, majna wrote:
You can use AppController or MyPluginAppController beforeRender() callback to check if controller name is 'CakeError'
and set $this->layout = 'MyPlugin.error'

or extend ExceptionRenderer

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

On Thursday, June 21, 2012 7:11:30 PM UTC+2, Mark Wratten wrote:
We are rewriting our site to use Cake 2.1 and I'm really loving the new features. The site has a back-end administration function which I have implemented as a plugin, including its own layout file. The admin function runs off its own host name, so I have a line in bootstrap.php that checks the hostname and if it matches, loads the plugin with its own routes.

Everything works great until an exception occurs. When that happens, the code uses the layout file from the main app, rather than the plugin. I'd like the Exception Handler to use the plugin layout, but I don't know how to configure it to do so other than by writing a new exception handler. Is there a quick way of configuring the layout to use?

Thanks

Mark

--
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: