So how, it's actually quite easy.
1. First define your child route.
'main_url' => array(
'type' => 'Literal',
'options' => array(
'route' => '/main/url',
'defaults' => array(
'__NAMESPACE__' => 'Main\Controller',
'controller' => 'Main',
'action' => 'url',
)
),
'may_terminate' => true,
'child_routes' => array (
'add' => array(
'type' => 'Literal',
'options' => array(
'route' => '/add',
'defaults' => array(
)
),
),
)
),
2. Call your child route using the url helper using the pattern 'parent/child'.
<?php echo $this->url('main_url/add', array()); ?>
With this you can now organize your routes more cleanly and strictly follow url heirarchies.
3 comments:
Exactly what I was looking for - thanks!
Exactly what i was looking for - thanks!
Post a Comment