mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing layout search paths for alternate content types
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4555 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
e8cfab14a0
commit
563f960ae0
2 changed files with 20 additions and 13 deletions
|
@ -1 +1,2 @@
|
|||
<?php echo $scripts_for_layout; ?>
|
||||
<?php echo $content_for_layout; ?>
|
|
@ -590,7 +590,8 @@ class View extends Object {
|
|||
'className' => $this->name,
|
||||
'action' => $action,
|
||||
'file' => $viewFileName,
|
||||
'base' => $this->base)));
|
||||
'base' => $this->base
|
||||
)));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -627,19 +628,21 @@ class View extends Object {
|
|||
$type = null;
|
||||
}
|
||||
|
||||
if(!is_null($this->layoutPath)){
|
||||
if(!is_null($this->layoutPath)) {
|
||||
$type = $this->layoutPath . DS;
|
||||
}
|
||||
|
||||
if (!is_null($this->plugin)) {
|
||||
if (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext)) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext;
|
||||
} elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext)) {
|
||||
return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext;
|
||||
} elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . '.thtml')) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . '.thtml';
|
||||
} elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . '.thtml')) {
|
||||
return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . '.thtml';
|
||||
$paths = array(
|
||||
APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext,
|
||||
APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext,
|
||||
APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . '.thtml',
|
||||
APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'layouts' . DS . $this->subDir . $type . $this->layout . '.thtml'
|
||||
);
|
||||
foreach ($paths as $path) {
|
||||
if (file_exists($path)) {
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -654,6 +657,9 @@ class View extends Object {
|
|||
}
|
||||
|
||||
$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');
|
||||
}
|
||||
if(is_null($layoutFileName)) {
|
||||
return 'missingLayout';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue