Yaf_Route_Static::route
(Yaf >=1.0.0)
Route a request
Description
Route the request according to the PATH_INFO style URI: the first path segment is treated as the module name only if it is one of the registered modules, otherwise the segments are mapped to the controller and the action in order. The remaining segments become request parameters.
For example, with no module named foo, /foo/bar/age/10 routes to the controller Foo, the action bar, with a parameter age of 10.
Parameters
requestThe
Yaf_Request_Abstractinstance to route.
Return Values
Always returns true.
Examples
Yaf_Route_Static::route example
<?php
$request = new Yaf_Request_Http("/product/detail/id/10");
/* the static route is the default route of Yaf_Router,
* registered under the name "_default" */
$route = Yaf_Dispatcher::getInstance()->getRouter()->getRoute("_default");
var_dump($route->route($request));
var_dump($request->getControllerName());
var_dump($request->getActionName());
var_dump($request->getParam("id"));
?>The above example will output something similar to:
bool(true)
string(7) "product"
string(6) "detail"
string(2) "10"See Also
Yaf_Route_Static::matchYaf_Route_Static::assemble