From 7ff6ac5bcb6a7c85cb875860d076c9c766bcdffe Mon Sep 17 00:00:00 2001 From: gwoo Date: Fri, 16 Mar 2007 20:36:24 +0000 Subject: [PATCH] updating themeView for 2225, fixing layout paths noticed when using email component git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4624 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/theme.php | 4 ++++ cake/libs/view/view.php | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cake/libs/view/theme.php b/cake/libs/view/theme.php index cc318b91c..b54f43b54 100644 --- a/cake/libs/view/theme.php +++ b/cake/libs/view/theme.php @@ -99,6 +99,10 @@ class ThemeView extends View { if(isset($params['plugin'])) { $this->plugin = $params['plugin']; $this->pluginPath = 'plugins' . DS . $this->plugin . DS; + $this->pluginPaths = array( + VIEWS . $this->pluginPath, + APP . $this->pluginPath . 'views' . DS, + ); } $paths = Configure::getInstance(); diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 63bb4abe4..35338fa86 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -604,7 +604,7 @@ class View extends Object { } /** - * Displays an error page to the user. Uses layouts/error.html to render the page. + * Displays an error page to the user. Uses layouts/error.ctp to render the page. * * @param int $code HTTP Error code (for instance: 404) * @param string $name Name of the error (for instance: Not Found) @@ -613,7 +613,7 @@ class View extends Object { function error($code, $name, $message) { header ("HTTP/1.1 {$code} {$name}"); print ($this->_render( - VIEWS . 'layouts/error.thtml', + LAYOUTS . 'error.ctp', array( 'code' => $code, 'name' => $name, @@ -713,12 +713,16 @@ class View extends Object { $layoutFileName = VIEWS . 'layouts' . DS . $name . $this->ext; } - $layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . $this->layout . '.ctp'); - if (empty($layoutFileName) && !empty($type)) { - $layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . 'default.ctp'); + $default = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . $this->layout . '.ctp'); + if (empty($default) && !empty($type)) { + $default = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . 'default.ctp'); } - if(is_null($layoutFileName)) { - return 'missingLayout'; + if(empty($default)) { + $default = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $this->layout . '.ctp'); + } + + if(!empty($default)) { + return $default; } return $layoutFileName; }