Hi all,

 From what I understand, issue #10896 (http://issues.ez.no/10896) asks 
that URLs of this form:
(1) http://www.example.com/(param1)/a/(param2)/x/(param2)/y

are treated as if they are of this form:
(2) http://www.example.com/(param1)/a/(param2)/x/y

Is this correct?


In the second case (2) things are normal, but you must specify 
MULTIPLE_ARGUMENTS for param2 to get all its values in an array:

<code>
$urlCfg = new ezcUrlConfiguration();
$urlCfg->addUnorderedParameter( 'param1' );
$urlCfg->addUnorderedParameter( 'param2', 
ezcUrlConfiguration::MULTIPLE_ARGUMENTS );

$url = new ezcUrl( 'http://www.example.com/(param1)/a/(param2)/x/y', 
$urlCfg );

$param1 = $url->getParam( 'param1' ); // returns "a"
$param2 = $url->getParam( 'param2' ); // returns array( "x", "y" )
</code>



In the first case, as it is now, even if you specify MULTIPLE_ARGUMENTS 
for param2, only the last value encountered is returned:

<code>
$urlCfg = new ezcUrlConfiguration();
$urlCfg->addUnorderedParameter( 'param1' );
$urlCfg->addUnorderedParameter( 'param2' );

$url = new ezcUrl( 
'http://www.example.com/(param1)/a/(param2)/x/(param2)/y', $urlCfg );

$param1 = $url->getParam( 'param1' ); // returns "a"
$param2 = $url->getParam( 'param2' ); // returns "y"
</code>


The feature request tries to implement returning all the values for 
param2 in an array.


But how should this be handled?

- should param2 be array( "x", "y" ) by default, even if 
MULTIPLE_ARGUMENTS are not specified for it?

- should param2 be array( "x", "y" ) by default, only if 
MULTIPLE_ARGUMENTS are specified for it?

- should param2 be array( "x", "y" ) only if a third parameter is 
specified for the addUnorderedParameter() function?

- should the URL be recreated (with buildUrl()) to form (1) (eventually 
based on a parameter of buildUrl() or addUnorderedParameter())?

- should the URL be recreated (with buildUrl()) to form (2) (eventually 
based on a parameter of buildUrl() or addUnorderedParameter())?


Take your time, don't rush to vote. We have all the time in the world 
until the alpha release. :)

Cheers,
Alex.

-- 
Alexandru Stanoi
eZ Components System Developer
eZ Systems | http://ez.no
-- 
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components

Reply via email to