[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/controller/ -> sfRouting.class.php (sommaire)

(pas de description)

Poids: 633 lignes (16 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

sfRouting:: (15 méthodes):
  getInstance()
  setCurrentRouteName()
  getCurrentRouteName()
  getCurrentInternalUri()
  getRoutes()
  setRoutes()
  hasRoutes()
  hasRouteName()
  getRouteByName()
  clearRoutes()
  prependRoute()
  appendRoute()
  connect()
  generate()
  parse()


Classe: sfRouting  - X-Ref

sfRouting class controls the creation of URLs and parses URLs. It maps an array of parameters to URLs definition.
Each map is called a route.
It implements the Singleton pattern.

Routing can be disabled when [sf_routing] is set to false.

This class is based on the Routes class of Cake framework.

getInstance()   X-Ref
Retrieve the singleton instance of this class.

return: sfRouting The sfRouting implementation instance

setCurrentRouteName($name)   X-Ref
Sets the current route name.

param: string The route name

getCurrentRouteName()   X-Ref
Gets the current route name.

return: string The route name

getCurrentInternalUri($with_route_name = false)   X-Ref
Gets the internal URI for the current request.

param: boolean Whether to give an internal URI with the route name (@route)
return: string The current internal URI

getRoutes()   X-Ref
Gets the current compiled route array.

return: array The route array

setRoutes($routes)   X-Ref
Sets the compiled route array.

param: array The route array
return: array The route array

hasRoutes()   X-Ref
Returns true if this instance has some routes.

return: boolean

hasRouteName($name)   X-Ref
Returns true if the route name given is defined.

param: string The route name
return: boolean

getRouteByName($name)   X-Ref
Gets a route by its name.

param: string The route name
return: array A route array

clearRoutes()   X-Ref
Clears all current routes.


prependRoute($name, $route, $default = array()   X-Ref
Adds a new route at the beginning of the current list of routes.


appendRoute($name, $route, $default = array()   X-Ref
Adds a new route.

Alias for the connect method.


connect($name, $route, $default = array()   X-Ref
Adds a new route at the end of the current list of routes.

A route string is a string with 2 special constructions:
- :string: :string denotes a named paramater (available later as $request->getParameter('string'))
- *: * match an indefinite number of parameters in a route

Here is a very common rule in a symfony project:

<code>
$r->connect('/:module/:action/*');
</code>

param: string The route name
param: string The route string
param: array  The default parameter values
param: array  The regexps parameters must match
return: array  current routes

generate($name, $params, $querydiv = '/', $divider = '/', $equals = '/')   X-Ref
Generates a valid URLs for parameters.

param: array  The parameter values
param: string The divider between key/value pairs
param: string The equal sign to use between key and value
return: string The generated URL

parse($url)   X-Ref
Parses a URL to find a matching route.

Returns null if no route match the URL.

param: string URL to be parsed
return: array  An array of parameters



Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7