Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed routing to allow for multiple directories to house controllers. #390

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion system/core/Router.php
Expand Up @@ -280,6 +280,12 @@ function _validate_request($segments)
// Set the directory and remove it from the segment array
$this->set_directory($segments[0]);
$segments = array_slice($segments, 1);

while(count($segments) > 0 && is_dir(APPPATH.'controllers/'.$this->directory.$segments[0])){
// Set the directory and remove it from the segment array
$this->set_directory($this->directory . $segments[0]);
$segments = array_slice($segments, 1);
}

if (count($segments) > 0)
{
Expand Down Expand Up @@ -465,7 +471,7 @@ function fetch_method()
*/
function set_directory($dir)
{
$this->directory = str_replace(array('/', '.'), '', $dir).'/';
$this->directory = $dir.'/';
}

// --------------------------------------------------------------------
Expand Down