Yaf_Route_Regex::__construct
The __construct purpose
&reftitle.description;
publicYaf_Route_Regex::__construct
stringmatch
arrayroute
arraymap
arrayverify
&warn.undocumented.func;
&reftitle.parameters;
match
A complete Regex pattern, will be used to match a request uri, if
doesn't matched, Yaf_Route_Regex will return
FALSE.
route
When the match pattern matches the request uri,
Yaf_Route_Regex will use this to decide which
m/c/a to routed.
either of m/c/a in this array is optianl, if you don't assgian a
specific value, it will be routed to default.
map
A array to assign name to the captrues in the match result.
verify
&reftitle.returnvalues;
&reftitle.examples;
Yaf_Route_Regexexample
getRouter()->addRoute("name",
new Yaf_Route_Regex(
"#^/product/([^/]+)/([^/])+#", //match request uri leading "/product"
array(
'controller' => "product", //route to product controller,
),
array(
1 => "name", // now you can call $request->getParam("name")
2 => "id", // to get the first captrue in the match pattern.
)
)
);
]]>
Yaf_Route_Regexexample
array(
"type" => "regex", //Yaf_Route_Regex route
"match" => "#(.*)#", //match arbitrary request uri
"route" => array(
'controller' => "product", //route to product controller,
'action' => "dummy", //route to dummy action
),
"map" => array(
1 => "uri", // now you can call $request->getParam("uri")
),
),
);
Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
new Yaf_Config_Simple($config));
]]>
&reftitle.seealso;
Yaf_Router::addRoute
Yaf_Router::addConfig
Yaf_Route_Static
Yaf_Route_Supervar
Yaf_Route_Simple
Yaf_Route_Rewrite
Yaf_Route_Map