API Documentation

Controller/Router/Rewrite.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Controller
subpackage
Router
version
$Id: Rewrite.php 22417 2010-06-11 14:15:05Z rob $
Classes
Zend_Controller_Router_Rewrite

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Controller_Router_Rewrite

Extends from
Zend_Controller_Router_Abstract
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Controller
see
http://manuals.rubyonrails.com/read/chapter/65
subpackage
Router
Properties
$_useDefaultRoutes
$_routes
$_currentRoute
$_globalParams
$_chainNameSeparator
$_useCurrentParamsAsGlobal
Methods
addDefaultRoutes
addRoute
addRoutes
addConfig
_getRouteFromConfig
_addChainRoutesFromConfig
removeRoute
removeDefaultRoutes
hasRoute
getRoute
getCurrentRoute
getCurrentRouteName
getRoutes
route
_setRequestParams
assemble
setGlobalParam
setChainNameSeparator
getChainNameSeparator
useRequestParametersAsGlobal

Description

Ruby routing based Router.

Properties

$_chainNameSeparator

string $_chainNameSeparator = '-'

Separator to use with chain names

Details

$_chainNameSeparator
string
visibility
protected
default
-
final
false
static
false

$_currentRoute

Zend_Controller_Router_Route_Interface $_currentRoute = 'null'

Currently matched route

Details

$_currentRoute
Zend_Controller_Router_Route_Interface
visibility
protected
default
null
final
false
static
false

$_globalParams

array $_globalParams = 'array'

Global parameters given to all routes

Details

$_globalParams
array
visibility
protected
default
array
final
false
static
false

$_routes

array $_routes = 'array'

Array of routes to match against

Details

$_routes
array
visibility
protected
default
array
final
false
static
false

$_useCurrentParamsAsGlobal

boolean $_useCurrentParamsAsGlobal = 'false'

Determines if request parameters should be used as global parameters inside this router.

Details

$_useCurrentParamsAsGlobal
boolean
visibility
protected
default
false
final
false
static
false

$_useDefaultRoutes

boolean $_useDefaultRoutes = 'true'

Whether or not to use default routes

Details

$_useDefaultRoutes
boolean
visibility
protected
default
true
final
false
static
false

Methods

_addChainRoutesFromConfig

_addChainRoutesFromConfig( string $name, Zend_Controller_Router_Route_Interface $route, Zend_Config $childRoutesInfo ) : void

Add chain routes from a config route

Arguments
$name
string
$route
Zend_Controller_Router_Route_Interface
$childRoutesInfo
Zend_Config
Details
visibility
protected
final
false
static
false

_getRouteFromConfig

_getRouteFromConfig( Zend_Config $info ) : Zend_Controller_Router_Route_Interface

Get a route frm a config instance

Arguments
$info
Zend_Config
Details
visibility
protected
final
false
static
false

_setRequestParams

_setRequestParams(  $request,  $params ) :
Arguments
$request
$params
Details
visibility
protected
final
false
static
false

addConfig

addConfig( Zend_Config $config, string $section = null ) : Zend_Controller_Router_Rewrite

Create routes out of Zend_Config configuration

Example INI: routes.archive.route = "archive/:year/*" routes.archive.defaults.controller = archive routes.archive.defaults.action = show routes.archive.defaults.year = 2000 routes.archive.reqs.year = "\d+"

routes.news.type = "Zend_Controller_Router_Route_Static" routes.news.route = "news" routes.news.defaults.controller = "news" routes.news.defaults.action = "list"

And finally after you have created a Zend_Config with above ini: $router = new Zend_Controller_Router_Rewrite(); $router->addConfig($config, 'routes');

Arguments
$config
Zend_Config
Configuration object
$section
string
Name of the config section containing route's definitions
Details
visibility
public
final
false
static
false
throws

addDefaultRoutes

addDefaultRoutes( ) : Zend_Controller_Router_Rewrite

Add default routes which are used to mimic basic router behaviour

Details
visibility
public
final
false
static
false

addRoute

addRoute( string $name, Zend_Controller_Router_Route_Interface $route ) : Zend_Controller_Router_Rewrite

Add route to the route chain

If route contains method setRequest(), it is initialized with a request object

Arguments
$name
string
Name of the route
$route
Zend_Controller_Router_Route_Interface
Instance of the route
Details
visibility
public
final
false
static
false

addRoutes

addRoutes( array $routes ) : Zend_Controller_Router_Rewrite

Add routes to the route chain

Arguments
$routes
array
Array of routes with names as keys and routes as values
Details
visibility
public
final
false
static
false

assemble

assemble( array $userParams, mixed $name = null, bool $reset = false, bool $encode = true ) : string

Generates a URL path that can be used in URL creation, redirection, etc.

Arguments
$userParams
array
Options passed by a user used to override parameters
$name
mixed
The name of a Route to use
$reset
bool
Whether to reset to the route defaults ignoring URL params
$encode
bool
Tells to encode URL parts on output
Output
string
Resulting absolute URL path
Details
visibility
public
final
false
static
false
throws

getChainNameSeparator

getChainNameSeparator( ) : string

Get the separator to use for chain names

Output
string
Details
visibility
public
final
false
static
false

getCurrentRoute

getCurrentRoute( ) : Zend_Controller_Router_Route_Interface

Retrieve a currently matched route

Details
visibility
public
final
false
static
false
throws

getCurrentRouteName

getCurrentRouteName( ) : Zend_Controller_Router_Route_Interface

Retrieve a name of currently matched route

Details
visibility
public
final
false
static
false
throws

getRoute

getRoute( string $name ) : Zend_Controller_Router_Route_Interface

Retrieve a named route

Arguments
$name
string
Name of the route
Details
visibility
public
final
false
static
false
throws

getRoutes

getRoutes( ) : array

Retrieve an array of routes added to the route chain

Output
array
All of the defined routes
Details
visibility
public
final
false
static
false

hasRoute

hasRoute( string $name ) : boolean

Check if named route exists

Arguments
$name
string
Name of the route
Output
boolean
Details
visibility
public
final
false
static
false

removeDefaultRoutes

removeDefaultRoutes( ) : Zend_Controller_Router_Rewrite

Remove all standard default routes

Details
visibility
public
final
false
static
false

removeRoute

removeRoute( string $name ) : Zend_Controller_Router_Rewrite

Remove a route from the route chain

Arguments
$name
string
Name of the route
Details
visibility
public
final
false
static
false
throws

route

route(  $request ) : Zend_Controller_Request_Abstract

Find a matching route to the current PATH_INFO and inject returning values to the Request object.

Arguments
$request
Output
Zend_Controller_Request_Abstract
Request object
Details
visibility
public
final
false
static
false
throws

setChainNameSeparator

setChainNameSeparator( string $separator ) : Zend_Controller_Router_Rewrite

Set the separator to use with chain names

Arguments
$separator
string
The separator to use
Details
visibility
public
final
false
static
false

setGlobalParam

setGlobalParam( string $name, mixed $value ) : Zend_Controller_Router_Rewrite

Set a global parameter

Arguments
$name
string
$value
mixed
Details
visibility
public
final
false
static
false

useRequestParametersAsGlobal

useRequestParametersAsGlobal( boolean|null $use = null ) : boolean|Zend_Controller_Router_Rewrite

Determines/returns whether to use the request parameters as global parameters.

Arguments
$use
booleannull
Null/unset when you want to retrieve the current state. True when request parameters should be global, false otherwise
Output
boolean|Zend_Controller_Router_Rewrite
Returns a boolean if first param isn't set, returns an instance of Zend_Controller_Router_Rewrite otherwise.
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.