From 0832e18e9e971acdb3e7e7aab3bfe85314b3bb7b Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 11 Mar 2012 22:31:53 +0530 Subject: [PATCH] Adding separate `error` layout for CakeErrorController as using `default` layout often caused nested errors. Closes #2682 --- app/View/Layouts/error.ctp | 61 +++++++++++++++++++ .../Templates/skel/View/Layouts/error.ctp | 59 ++++++++++++++++++ lib/Cake/Error/ExceptionRenderer.php | 1 + 3 files changed, 121 insertions(+) create mode 100644 app/View/Layouts/error.ctp create mode 100644 lib/Cake/Console/Templates/skel/View/Layouts/error.ctp diff --git a/app/View/Layouts/error.ctp b/app/View/Layouts/error.ctp new file mode 100644 index 000000000..49477342e --- /dev/null +++ b/app/View/Layouts/error.ctp @@ -0,0 +1,61 @@ + + + + + Html->charset(); ?> + + <?php echo $cakeDescription ?>: + <?php echo $title_for_layout; ?> + + Html->meta('icon'); + + echo $this->Html->css('cake.generic'); + + echo $this->fetch('meta'); + echo $this->fetch('css'); + echo $this->fetch('script'); + ?> + + +
+ +
+ + Session->flash(); ?> + + fetch('content'); ?> +
+ +
+ element('sql_dump'); ?> + + diff --git a/lib/Cake/Console/Templates/skel/View/Layouts/error.ctp b/lib/Cake/Console/Templates/skel/View/Layouts/error.ctp new file mode 100644 index 000000000..c7d67871f --- /dev/null +++ b/lib/Cake/Console/Templates/skel/View/Layouts/error.ctp @@ -0,0 +1,59 @@ + + + + + Html->charset(); ?> + + <?php echo __('CakePHP: the rapid development php framework:'); ?> + <?php echo $title_for_layout; ?> + + Html->meta('icon'); + + echo $this->Html->css('cake.generic'); + + echo $this->fetch('meta'); + echo $this->fetch('css'); + echo $this->fetch('script'); + ?> + + +
+ +
+ + Session->flash(); ?> + + fetch('content'); ?> +
+ +
+ element('sql_dump'); ?> + + diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php index 16c577969..3b8671254 100644 --- a/lib/Cake/Error/ExceptionRenderer.php +++ b/lib/Cake/Error/ExceptionRenderer.php @@ -280,6 +280,7 @@ class ExceptionRenderer { $this->controller->subDir = ''; $this->controller->viewPath = 'Errors/'; $this->controller->viewClass = 'View'; + $this->controller->layout = 'error'; $this->controller->helpers = array('Form', 'Html', 'Session'); $this->controller->render($template);