Last active
December 29, 2015 19:19
-
-
Save felixmc/7716541 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Load controllers for setting up manual controller routes to allow for dynamic custom page routes | |
* */ | |
$controllers = array(); | |
foreach (scandir( APPPATH . "controllers" ) as $file) { | |
$fileParts = explode(".", $file); | |
if ($fileParts[1] === "php") | |
array_push($controllers, $fileParts[0]); | |
} | |
$route['default_controller'] = "home"; | |
$route['404_override'] = ''; | |
// add controllers to routes | |
foreach ($controllers as $controller) { | |
$route[$controller . '/(:any)'] = $controller . '/$1'; | |
$route[$controller] = $controller ; | |
} | |
$route[':any'] = "staticpage"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment