Skip to content

Commit

Permalink
Fix for controlers in subfolders
Browse files Browse the repository at this point in the history
  • Loading branch information
ElbertF committed Aug 7, 2012
1 parent 892ab95 commit 264af68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Swiftlet/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ public function run()
}

if ( !is_file('Swiftlet/Controllers/' . $controllerName . '.php') ) {
$controllerName = 'Error404';
$controllerName .= '/Index';

if ( !is_file('Swiftlet/Controllers/' . $controllerName . '.php') ) {
$controllerName = 'Error404';
}
}

$this->view = new View($this, strtolower($controllerName));

// Instantiate the controller
$controllerName = 'Swiftlet\Controllers\\' . basename($controllerName);
$controllerName = 'Swiftlet\Controllers\\' . str_replace('/', '\\', $controllerName);

$this->controller = new $controllerName($this, $this->view);

Expand Down

0 comments on commit 264af68

Please sign in to comment.