From fe82e827f0273a5cc9d52a7776130fe669aa375c Mon Sep 17 00:00:00 2001 From: DarkAngelBGE Date: Mon, 8 Sep 2008 15:44:32 +0000 Subject: [PATCH] Refactoring ScaffoldView::_getViewFileName() git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7569 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/controller/scaffold.php | 11 +++++------ cake/libs/view/view.php | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) 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;