On Mon, Aug 5, 2013 at 2:17 PM, Matthew Weier O'Phinney <[email protected]>wrote:
> I'd do this as a set of nested routes:
>
> 'parent' => array(
> 'type' => 'segment',
> 'options' => array(
> 'route' => '/a/:version/route',
> 'criteria' => array(
> 'version' => '\d+\.\d+',
> ),
> ),
> 'may_terminate' => false,
> 'child_routes' = array(
> 'component' => array(
> 'type' => 'segment',
> 'options' => array(
> 'route' => '/:controller',
> 'defaults' => array(
> 'action' => 'index',
> ),
> ),
> 'may_terminate' => true,
> 'child_routes' = array(
> 'path' => array(
> 'type' => 'segment',
> 'options' => array(
> 'route' => '/:fullpath',
> ),
> ),
> ),
> ),
> ),
> ),
>
>
Afternoon Matt, and ZFW List. I'm back to this.
I have it working, almost. I get it now, but I'm running into a problem
with the path child route: it's not working. When ever I add a path, or
additional resource key, it fails:
/a/2.1/route/cntl -> works.
/a/2.1/route/cntl/name -> works
/a/2.1/route/cntl/a/resource/path.jpg -> fails -- Error: The requested URL
could not be matched by routing.
Oddly enough, I overloaded Segment::match() and I see a RouteMatch
returning. Not sure why it's failing after that.
I've even shortened it to:
'type' => 'segment',
'options' => array(
'route' => '/a/:version/route/:controller',
'criteria' => array(
'version' => '\d+\.\d+',
'controller' => '[a-z][\w]+',
),
),
'may_terminate' => true,
'child_routes' => array(
'path' => array(
'type' => 'segment',
'options' => array(
'route' => '/:resource',
),
),
),
It works with case 1 and 2, but fails with case 3.
---
Philip
[email protected]
http://www.gpcentre.net/