diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php index 949854b81..454fad4f0 100644 --- a/cake/libs/controller/scaffold.php +++ b/cake/libs/controller/scaffold.php @@ -510,14 +510,13 @@ class ScaffoldView extends ThemeView { } $paths = $this->_paths($this->plugin); + $exts = array($this->ext, '.ctp', '.thtml'); foreach ($paths as $path) { foreach ($names as $name) { - if (file_exists($path . $name . $this->ext)) { - return $path . $name . $this->ext; - } elseif (file_exists($path . $name . '.ctp')) { - return $path . $name . '.thtml'; - } elseif (file_exists($path . $name . '.thtml')) { - return $path . $name . '.thtml'; + foreach ($exts as $ext) { + if (file_exists($path . $name . $ext)) { + return $path . $name . $ext; + } } } } diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index f51492a70..b5756eb9b 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -837,8 +837,8 @@ class View extends Object { $paths = $this->_paths($this->plugin); $file = 'layouts' . DS . $subDir . $name; + $exts = array($this->ext, '.ctp', '.thtml'); foreach ($paths as $path) { - $exts = array($this->ext, '.ctp', '.thtml'); foreach ($exts as $ext) { if (file_exists($path . $file . $ext)) { return $path . $file . $ext;