Refactoring ScaffoldView::_getViewFileName()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7569 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2008-09-08 15:44:32 +00:00
parent 311072f4ae
commit fe82e827f0
2 changed files with 6 additions and 7 deletions

View file

@ -510,14 +510,13 @@ class ScaffoldView extends ThemeView {
} }
$paths = $this->_paths($this->plugin); $paths = $this->_paths($this->plugin);
$exts = array($this->ext, '.ctp', '.thtml');
foreach ($paths as $path) { foreach ($paths as $path) {
foreach ($names as $name) { foreach ($names as $name) {
if (file_exists($path . $name . $this->ext)) { foreach ($exts as $ext) {
return $path . $name . $this->ext; if (file_exists($path . $name . $ext)) {
} elseif (file_exists($path . $name . '.ctp')) { return $path . $name . $ext;
return $path . $name . '.thtml'; }
} elseif (file_exists($path . $name . '.thtml')) {
return $path . $name . '.thtml';
} }
} }
} }

View file

@ -837,8 +837,8 @@ class View extends Object {
$paths = $this->_paths($this->plugin); $paths = $this->_paths($this->plugin);
$file = 'layouts' . DS . $subDir . $name; $file = 'layouts' . DS . $subDir . $name;
$exts = array($this->ext, '.ctp', '.thtml');
foreach ($paths as $path) { foreach ($paths as $path) {
$exts = array($this->ext, '.ctp', '.thtml');
foreach ($exts as $ext) { foreach ($exts as $ext) {
if (file_exists($path . $file . $ext)) { if (file_exists($path . $file . $ext)) {
return $path . $file . $ext; return $path . $file . $ext;