(Yaf >=1.0.0)
Yaf_Route_Map::__construct — Construct a map route
Construct a map route. A map route maps the whole URI to a controller name or an action name.
controller_preferWhether to map the URI to a controller name. If false, the URI is mapped to an action name.
delimiterThe delimiter used to separate the mapped name from the request parameters in the URI. If it occurs as a path segment preceded by a slash, everything after it is parsed as request parameters instead of being part of the mapped name. If empty, no such splitting happens during routing.
No value is returned.
Example #1 Yaf_Route_Map example
<?php
/**
* Add a map route to the Yaf_Router route stack
*/
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name",
new Yaf_Route_Map());
?>The above example will output something similar to:
/* for http://yourdomain.com/product/foo/bar * the request will carry the following values: */ array( "action" => "product_foo_bar", )
Example #2 Yaf_Route_Map example
<?php
/**
* Add a map route with a delimiter to the Yaf_Router route stack
*/
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name",
new Yaf_Route_Map(true, "_"));
?>The above example will output something similar to:
/* for http://yourdomain.com/user/list/_/foo/22
* the request will carry the following values:
*/
array(
"controller" => "User_List",
)
/**
* and request parameters:
*/
array(
"foo" => "22",
)
Example #3 Yaf_Route_Map example
<?php
/**
* Add a map route to the route stack by calling addConfig
*/
$config = array(
"name" => array(
"type" => "map", // Yaf_Route_Map route
"controllerPrefer" => FALSE,
"delimiter" => "#!",
),
);
Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
new Yaf_Config_Simple($config));
?>