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
This commit is contained in:
gwoo 2007-03-16 20:36:24 +00:00
parent 48a1a9cba2
commit 7ff6ac5bcb
2 changed files with 15 additions and 7 deletions

View file

@ -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();

View file

@ -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;
}