More Route Examples
There are countless other possibilities for routes. Here are some more examples:
Route::set( 'auth' , '<action>' , |
'action' => '(login|logout)' |
Route::set( 'feeds' , '<user_id>(/<action>).<format>' , |
'format' => '(rss|atom|json)' , |
Route::set( 'static' , '<path>.html' , |
'path' => '[a-zA-Z0-9_/]+' , |
'controller' => 'static' , |
Route::set( 'gallery' , '<action>(<controller>):<id>' , |
'controller' => '[A-Z][a-z]++' , |
'action' => '[A-Z][a-z]++' , |
'controller' => 'Slideshow' , |
Route::set( 'search' , ':<query>' , array ( 'query' => '.*' )) |
'controller' => 'search' , |
Routes are matched in the order specified so be aware that if you set routes after the modules have been loaded a module could specify a route that conflicts with your own. This is also the reason that the default route is set last, so that custom routes will be tested first.
0 comments:
Post a Comment