Created
February 16, 2012 21:38
-
-
Save jakefolio/1848068 to your computer and use it in GitHub Desktop.
Only load the routes you want based off of URI params
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 | |
// Stupid dirty example of how to load only the routes you want. | |
$app->hook('slim.before.router', function() use ($app) { | |
$uri = $app->request()->getResourceUri(); | |
$params = explode('/', substr($uri, 1, strlen($uri))); | |
if (file_exists(APP_ROOT . '/app/routes/' . $params[0] . '.php')) | |
include APP_ROOT . '/app/routes/' . $params[0] . '.php'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment