Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions system/core/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions user_guide_src/source/general/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
===============================

Expand Down