Controller_Routing_Builder is used as a convenient way to add routes to the system.
Building Routes
There are three primary methods the builder exposes for adding routes: match, regex, and root. Most routes can be added using the match method. As a simple example, take the default routes (assuming $route is an instance of Controller_Routing_Builder):
The regex method allows an entire regular expression to be evaluated against the URL:
Lastly, root allows you to connect a route to the root URL (/):
Parameters
There are two ways to set parameters as part of a route. With the match method, any parameter name may be prefixed with a colon (:) within the URL to indicate it is to be pulled from that location:
Additionally, all of the builder methods accept an array of default parameter values as the first argument following any path matching information:
Constraints
All of the builder methods also accept a second array argument which can be used to impose further matching conditions. One type of matching constraint is to limit the HTTP method used to access the route:
The second type of constraint requires a string or regular expression to match a parameter value (the parameter name is provided as the key):
Located in /controller/lib/Controller/Routing/Builder.php (line 97)
Constructor
The match method adds a route based on matching a URL string with optional embedded parameters.
See the class documentation for more details and examples.
The regex method adds a route based on regular expression to be evaluated against the complete URL.
See the class documentation for more details and examples.
The root method adds a route that matches the site root URL.
See the class documentation for more details and examples.
Documentation generated on Wed, 25 Apr 2012 09:46:41 -0700 by phpDocumentor 1.4.3