Created
April 11, 2011 04:10
-
-
Save alganet/913047 to your computer and use it in GitHub Desktop.
Toying with microframework concepts
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 | |
//users | |
Web::serve('/users', function() { | |
return 'Hello World'; | |
}); | |
//users/alganet | |
Web::serve('/users/*', function($screenName) { | |
return "Hello $screenName"; | |
}); | |
//posts/2010/10/10/comments | |
Web::serve('/posts/*/*/*/comments', function($year, $month, $day) { | |
}); | |
//users/alganet/lists/php | |
Web::serve('/users/*/lists/*', function($screenName, $listName) { | |
}); | |
//users/alganet | |
$view = Twig_BlaBlaBla(); | |
Web::serve('/users/*', function($screenName) use ($view) { | |
return $view | |
->loadTemplate("user.phtml") | |
->display(array("screen_name"=>$screenName)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment