diff --git a/system/core/Loader.php b/system/core/Loader.php index 648b7cfc7c2..8b25b913011 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -915,6 +915,18 @@ protected function _ci_load($_ci_data) break; } + // checks if there is a directory with that name and a contained index.php. + if(!file_exists($_ci_view_file.$_ci_file) && is_dir( str_replace('.php', '/', $_ci_view_file.$_ci_file))) + { + $_ci_file = str_replace('.php', '/', $_ci_view_file.$_ci_file).'index.php'; + if(file_exists($_ci_file)) + { + $_ci_path = $_ci_file; + $file_exists = TRUE; + break; + } + } + if ( ! $cascade) { break; diff --git a/user_guide_src/source/general/views.rst b/user_guide_src/source/general/views.rst index b84e8539956..d47879590fd 100644 --- a/user_guide_src/source/general/views.rst +++ b/user_guide_src/source/general/views.rst @@ -98,6 +98,15 @@ directory name loading the view. Example:: $this->load->view('directory_name/file_name'); +Or just passing the directory name it will fetch a file from index. +Example: + + $this->load->view('directory_name'); + +if you do not have a file with that name, it is the equivalent of: + + $this->load->view('directory_name/index'); + Adding Dynamic Data to the View ===============================