Routing of nested modules

Notice: This thread is very old.
medhi
Generous Backer | 255
+
0
-

Is it possible to create routes (with default values) for nested modules? How? Could you please provide a nice example, that we can then put into documentation?

Example structure:

app
	Admin
		Blue
			presenters
			templates
		presenters
		templates
	Front
	presenters
	templates

Admin and Front are modules and Admin module contain Blue module.

How route with default values should look like? Based on this example:

$route = new Route('<presenter>/<action>/<id>', array(
    'presenter' => 'Homepage',
    'action' => 'default',
    'id' => NULL,
));

Thank you

llsm
Member | 121
+
0
-

You can modify modules routes using <module> in your route. Example (generates <yourDomain>/front/home-page/index/<id>):

<?php
$router[] = new Route('<module>/<presenter>/<action>[/<id>]', array(
	'module' => 'Front',
	'presenter' => 'HomePage',
	'action' => 'index',
	'id' => NULL
));
?>

As far as I know, you can use <module> variable only once, but in case of nested modules something like this should work (generates <yourDomain>/blue-home-page/<id>):

<?php
$router[] = new Route('blueHomePage/<id>', array(
	'module' => 'Admin:Blue',
	'presenter' => 'HomePage',
	'action' => 'index',
	'id' => NULL
));
?>
medhi
Generous Backer | 255
+
0
-

Thank you, it works.