New Page Param handling
First, cause it’s easier.
Page parameters will now support a new structure.
old method:
http://host/zone/zone_param/page/pageparam
new method:
http://host/zone/zone_param/page/pageParamKey:pageparam/pageParam/pagePa...
New Functions:
$zone->getPageParam($name);$zone->getPageParams();
The latter will return an array of the page parameters.
an example:
http://host/zone/zone_param/page/Foo:Bar/Tar/Zoo:Far:Jar
$zone->getPageParams();
would return:
array(
[Foo] => Bar,
[1] => Tar,
[Zoo] => array (
[0] => Far,
[1] => Jar
)
);
The $inPath param is no longer needed, but remains unchanged for compatibility reasons.
New Zone Param handling
Zone parameters now have a good amount of new functionality and additional flexibility. The general use is the same. You still need to define the zone Param names which is a fixed number so the URL can be effectively parsed.
New SPECIAL WILDCARD param names.
*
equal to {0,..}
+
equal to {1,..}
{min,max}
min is numeric max is numeric or ‘..’ which represents infinite.
?
equal to {1,1}
Caveats
- The wildcard params require the new key:value structure.
- Wildcard params are necessarily greedy. * or + will expand to eat every contiguous key:value pair param. Thus, two wildcard params cannot be next to each other. If you really need two sets of wildcard params, put a named parameter between them.
- Obviously if you are using the new key:value params you can’t use a “:” char in your named params.
Logic
The logic is simple if there is a fixed count it works as before. If there isn’t a fixed count then the last param is found by finding token before the instance of a token without a “:” char. These special param names can be used interspersed among standard param names.
zone_name/zone_param/?/*/zone_param/+/page_name/page_param
Operation
Works similarly to page params. Keys become the param names and will appear mixed in with the standard zone param names. Supports key:val1:val2:... as [name] => array( val1, val2, ...).
The new methods operate similarly to the correlating page methods.
$zone->getZoneParams()
$zone->getZoneParam($name)