Welcome to URI Demo Home
Here you can test and learn about the handling of URI routes in Doo framework.
Check out the links page for a list of URLs available in this demo. All links can be accessed with or without 'index.php'.
See the routes.conf.php source.
# There is a controller called HelloController # The controller has 3 methods index, walao, sayhi /hello /hello/walao /hello/sayhi/doophp # Get variables can be used as well /hello/sayhi/doophp/?title=Mr. # Camel case in auto routes, CamelCaseController /camel-case /camel-case/moo
# There is a controller called SimpleController # The controller has 1 methods simple() /simple /simple.html /simple.json /simple.rss # Dynamic routes defined as $route['*']['/simple/:pagename'] # Call $this->extension to get the extension name. /simple/superpage.json /simple/some page.rss /simple/only_xml/pagename.xml - This route only support .xml
# You might want to use Firefox Poster addon for a quick test. /api/food/list/1.json - GET return result in Json format /api/food/list/1.xml - GET return result in Xml format /api/food/create - POST request, post variable to test /api/food/update - PUT request, send a PUT request to test /api/food/delete/1 - DELETE request, send a DELETE request to test
// here's how you do redirection to an existing route internally // http status code is optional, default 302 Moved Temporarily /about /home // redirect to http://doophp.com /doophp // If you have tamper data FF addon, you can see a 301 status is issued instead of 302 /easier
Test drive routes with Authentication
// Http digest auth and subfolder example. // the Admin controller is in a subfolder 'admin' // it is easier to manage controller files with Doophp /admin # Login with 'admin'=>'1234' or 'demo'=>'abc'
// You can match a parameter's value against a pattern // If not matched it will throw up 404 error. /news/2009/07 // Values that do not match /news/10009/aa /** * The matching pattern * year ^\d{4}$ * month ^\d{2}$ */
//almost identical routes examples, must assigned a matching pattern to the parameters //if no pattern is assigned, it will match the route defined first. # this show news by id /news/88 # this show news by title /news/doophp is great /** * The matching pattern * id ^\d+$ * title [a-z0-9]+ */BACK TO TOP