Skip to content
This repository
Browse code

Adding separate `error` layout for CakeErrorController as using `defa…

…ult` layout often caused nested errors. Closes #2682
  • Loading branch information...
commit 0832e18e9e971acdb3e7e7aab3bfe85314b3bb7b 1 parent 47a2c22
ADmad authored March 11, 2012
61  app/View/Layouts/error.ctp
... ...
@@ -0,0 +1,61 @@
  1
+<?php
  2
+/**
  3
+ *
  4
+ * PHP 5
  5
+ *
  6
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  7
+ * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  8
+ *
  9
+ * Licensed under The MIT License
  10
+ * Redistributions of files must retain the above copyright notice.
  11
+ *
  12
+ * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  13
+ * @link          http://cakephp.org CakePHP(tm) Project
  14
+ * @package       Cake.View.Layouts
  15
+ * @since         CakePHP(tm) v 0.10.0.1076
  16
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
  17
+ */
  18
+
  19
+$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');
  20
+?>
  21
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  22
+<html xmlns="http://www.w3.org/1999/xhtml">
  23
+<head>
  24
+	<?php echo $this->Html->charset(); ?>
  25
+	<title>
  26
+		<?php echo $cakeDescription ?>:
  27
+		<?php echo $title_for_layout; ?>
  28
+	</title>
  29
+	<?php
  30
+		echo $this->Html->meta('icon');
  31
+
  32
+		echo $this->Html->css('cake.generic');
  33
+
  34
+		echo $this->fetch('meta');
  35
+		echo $this->fetch('css');
  36
+		echo $this->fetch('script');
  37
+	?>
  38
+</head>
  39
+<body>
  40
+	<div id="container">
  41
+		<div id="header">
  42
+			<h1><?php echo $this->Html->link($cakeDescription, 'http://cakephp.org'); ?></h1>
  43
+		</div>
  44
+		<div id="content">
  45
+
  46
+			<?php echo $this->Session->flash(); ?>
  47
+
  48
+			<?php echo $this->fetch('content'); ?>
  49
+		</div>
  50
+		<div id="footer">
  51
+			<?php echo $this->Html->link(
  52
+					$this->Html->image('cake.power.gif', array('alt' => $cakeDescription, 'border' => '0')),
  53
+					'http://www.cakephp.org/',
  54
+					array('target' => '_blank', 'escape' => false)
  55
+				);
  56
+			?>
  57
+		</div>
  58
+	</div>
  59
+	<?php echo $this->element('sql_dump'); ?>
  60
+</body>
  61
+</html>
59  lib/Cake/Console/Templates/skel/View/Layouts/error.ctp
... ...
@@ -0,0 +1,59 @@
  1
+<?php
  2
+/**
  3
+ *
  4
+ * PHP 5
  5
+ *
  6
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  7
+ * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  8
+ *
  9
+ * Licensed under The MIT License
  10
+ * Redistributions of files must retain the above copyright notice.
  11
+ *
  12
+ * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  13
+ * @link          http://cakephp.org CakePHP(tm) Project
  14
+ * @package       app.View.Layouts
  15
+ * @since         CakePHP(tm) v 0.10.0.1076
  16
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
  17
+ */
  18
+?>
  19
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  20
+<html xmlns="http://www.w3.org/1999/xhtml">
  21
+<head>
  22
+	<?php echo $this->Html->charset(); ?>
  23
+	<title>
  24
+		<?php echo __('CakePHP: the rapid development php framework:'); ?>
  25
+		<?php echo $title_for_layout; ?>
  26
+	</title>
  27
+	<?php
  28
+		echo $this->Html->meta('icon');
  29
+
  30
+		echo $this->Html->css('cake.generic');
  31
+
  32
+		echo $this->fetch('meta');
  33
+		echo $this->fetch('css');
  34
+		echo $this->fetch('script');
  35
+	?>
  36
+</head>
  37
+<body>
  38
+	<div id="container">
  39
+		<div id="header">
  40
+			<h1><?php echo $this->Html->link(__('CakePHP: the rapid development php framework'), 'http://cakephp.org'); ?></h1>
  41
+		</div>
  42
+		<div id="content">
  43
+
  44
+			<?php echo $this->Session->flash(); ?>
  45
+
  46
+			<?php echo $this->fetch('content'); ?>
  47
+		</div>
  48
+		<div id="footer">
  49
+			<?php echo $this->Html->link(
  50
+					$this->Html->image('cake.power.gif', array('alt' => __('CakePHP: the rapid development php framework'), 'border' => '0')),
  51
+					'http://www.cakephp.org/',
  52
+					array('target' => '_blank', 'escape' => false)
  53
+				);
  54
+			?>
  55
+		</div>
  56
+	</div>
  57
+	<?php echo $this->element('sql_dump'); ?>
  58
+</body>
  59
+</html>
1  lib/Cake/Error/ExceptionRenderer.php
@@ -280,6 +280,7 @@ protected function _outputMessageSafe($template) {
280 280
 		$this->controller->subDir = '';
281 281
 		$this->controller->viewPath = 'Errors/';
282 282
 		$this->controller->viewClass = 'View';
  283
+		$this->controller->layout = 'error';
283 284
 		$this->controller->helpers = array('Form', 'Html', 'Session');
284 285
 
285 286
 		$this->controller->render($template);

0 notes on commit 0832e18

Please sign in to comment.
Something went wrong with that request. Please try again.