@@ -805,14 +805,13 @@ function _getViewFileName($name = null) {
805
805
}
806
806
807
807
$ paths = $ this ->_paths (Inflector::underscore ($ this ->plugin ));
808
-
809
- foreach ($ paths as $ path ) {
810
- if (file_exists ($ path . $ name . $ this ->ext )) {
811
- return $ path . $ name . $ this ->ext ;
812
- } elseif (file_exists ($ path . $ name . '.ctp ' )) {
813
- return $ path . $ name . '.ctp ' ;
814
- } elseif (file_exists ($ path . $ name . '.thtml ' )) {
815
- return $ path . $ name . '.thtml ' ;
808
+
809
+ $ exts = array ($ this ->ext , '.ctp ' , '.thtml ' );
810
+ foreach ($ exts as $ ext ) {
811
+ foreach ($ paths as $ path ) {
812
+ if (file_exists ($ path . $ name . $ ext )) {
813
+ return $ path . $ name . $ ext ;
814
+ }
816
815
}
817
816
}
818
817
$ defaultPath = $ paths [0 ];
@@ -848,8 +847,8 @@ function _getLayoutFileName($name = null) {
848
847
$ file = 'layouts ' . DS . $ subDir . $ name ;
849
848
850
849
$ exts = array ($ this ->ext , '.ctp ' , '.thtml ' );
851
- foreach ($ paths as $ path ) {
852
- foreach ($ exts as $ ext ) {
850
+ foreach ($ exts as $ ext ) {
851
+ foreach ($ paths as $ path ) {
853
852
if (file_exists ($ path . $ file . $ ext )) {
854
853
return $ path . $ file . $ ext ;
855
854
}
0 commit comments