Skip to content

Instantly share code, notes, and snippets.

@dustinlakin
Created April 5, 2012 09:08
Show Gist options
  • Save dustinlakin/2309375 to your computer and use it in GitHub Desktop.
Save dustinlakin/2309375 to your computer and use it in GitHub Desktop.
Routes and Controllers
<?php
$app = new Slim();
//routes here
$app->get('/', 'home');
$app->get('/hi/:first(/)', 'hi');
$app->get('/test(/)', 'test');
$app->run();
//controllers here!
function home(){
global $config;
$title = "Hello World";
require $config->viewsPath . "header.php";
require $config->viewsPath . "home.php";
require $config->viewsPath . "footer.php";
}
function hi($first){
echo "hi $first";
}
function test(){
phpinfo();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment