Path

ez components / documentation / api reference / 2006.2 / url


eZ Components 2006.2

Url: ezcUrlConfiguration

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcUrlConfiguration

ezcUrlConfiguration makes it possible to use a custom url form in your application. [source]
Example of use:
 1.  // create an ezcUrlConfiguration object
 2.   $urlCfg new ezcUrlConfiguration();
 3.  // set the basedir and script values
 4.   $urlCfg->basedir 'mydir';
 5.  $urlCfg->script 'index.php';
 6.  
 7.  // define delimiters for unordered parameter names
 8.   $urlCfg->unorderedDelimiters array'('')' );
 9.  
10.  // define ordered parameters
11.   $urlCfg->addOrderedParameter'section' );
12.  $urlCfg->addOrderedParameter'group' );
13.  $urlCfg->addOrderedParameter'category' );
14.  $urlCfg->addOrderedParameter'subcategory' );
15.  
16.  // define unordered parameters
17.   $urlCfg->addUnorderedParameter'game'ezcUrlConfiguration::MULTIPLE_ARGUMENTS );
18.  
19.  // create a new ezcUrl object from a string url and use the above $urlCfg
20.   $url new ezcUrl'http://www.example.com/mydir/index.php/groups/Games/Adventure/Adult/(game)/Larry/7'$urlCfg );
21.  
22.  // to get the parameter values from the url use $url->getParam():
23.   $section =  $url->getParam'section' )// will be "groups"
24.   $group $url->getParam'group' )// will be "Games"
25.   $category $url->getParam'category' )// will be "Adventure"
26.   $subcategory $url->getParam'subcategory' )// will be "Adult"
26.   $game $url->getParam'game' )// will be array( "Larry", "7" )

Constants

MULTIPLE_ARGUMENTS = 2 Flag for specifying multiple arguments for unordered parameters.
SINGLE_ARGUMENT = 1 Flag for specifying single arguments for unordered parameters.

Properties

string read/write  $basedir
The part of the url after the first slash. It can be null. Example: $basedir = shop in http://www.example.com/shop
string read/write  $orderedParameters
The ordered parameters of the url. Example: $orderedParameters = array( 'section', 'module', 'view', 'content' ); url = http://www.example.com/doc/components/view/trunk
string read/write  $script
The default php script, which comes after the basedir. Can be null if the web server configuration is set to hide it. Example: $script = index.php in http://www.example.com/shop/index.php
array read/write  $unorderedDelimiters
The delimiters for the unordered parameters names. Example: $unorderedDelimiters = array( '(', ')' ) for url = http://www.example.com/doc/(file)/classtrees_Base.html
string read/write  $unorderedParameters
The unordered parameters of the url. Example: $unorderedParameters = array( 'file' ); url = http://www.example.com/doc/(file)/classtrees_Base.html

Method Summary

public ezcUrlConfiguration __construct( )
Constructs a new ezcUrlConfiguration object.
public void addOrderedParameter( $name )
Adds an ordered parameter to the url configuration.
public void addUnorderedParameter( $name, [$type = null] )
Adds an unordered parameter to the url configuration.

Methods

__construct

ezcUrlConfiguration __construct( )
Constructs a new ezcUrlConfiguration object.

addOrderedParameter

void addOrderedParameter( string $name )
Adds an ordered parameter to the url configuration.

Parameters

Name Type Description
$name string  

addUnorderedParameter

void addUnorderedParameter( string $name, [int $type = null] )
Adds an unordered parameter to the url configuration.
The default type is SINGLE_ARGUMENT.

Parameters

Name Type Description
$name string  
$type int  

Last updated: Thu, 01 Nov 2007