ako routovat modularnu aplikaciu

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
duskohu
Člen | 778
+
0
-

Ahojte viete mi poradit?

Mam asi takuto striktiru:
Teraz mam routu default:
http://example.com/cms.admin.default
http://example.com/cms.front.default

ale ako urobit toto?
http://example.com/admin/cms/default
http://example.com/admin/forum/default

a v pripade front modulov
http://example.com/cms/default
http://example.com/forum/default

a ako zabezpecit ked dam:
http://example.com/admin >> aby mi nacitalo >> BaseModule:DefaultPresenter ??
a ked zadam?  http://example.com >> napr. CmsModule:FrontModule:DefaultPresenter??

cital som si nieco na https://doc.nette.org/…tion/routing ale velmi nepomohlo, viete mi niekto poradit?

\app
	->BaseModule
		->DefaultPresenter
	->CmsModule
		->AdminModule
			->DefaultPresenter
		->FrontModule
			->DefaultPresenter
	->ForumModule
		->AdminModule
			->DefaultPresenter
		->FrontModule
			->DefaultPresenter
Marek Šneberger
Člen | 130
+
0
-

Examples na GitHubu a nebo ve staženém balíku s Nette ;) Mrkni na Bootstrap a na BasePresenter

duskohu
Člen | 778
+
0
-

ano to som pozeral: ale ja to mam otocene… podarilo sa mi len ten index vyriesit

	$container->router[] = new Route('index.php', 'Cms:Front:Homepage:default', Route::ONE_WAY);
/** ???????
	$container->router[] = $adminRouter = new RouteList('Admin');
	$adminRouter[] = new Route('admin/<presenter>/<action>', 'Default:default');

	$container->router[] = $frontRouter = new RouteList('Front');
	$frontRouter[] = new Route('<presenter>/<action>[/<id>]', 'Default:default');
*//
duskohu
Člen | 778
+
0
-

Tak sa mi to nakoniec podarilo, len sa mi zda ze je toho nejako vela, neda sa to trosku zmensit?
http://example.com/ >> ide na >> cms
http://example.com/admin >> ide na admin

http://example.com/forum .....
http://example.com/admin/forum

// Setup router
$container->router[] = new Route('index.php', 'Cms:Front:Homepage:default', Route::ONE_WAY);

// Admin
$container->router[] = new Route('admin/cms/<presenter><action>', array(
    'module' => 'Cms:Admin',
    'presenter' => 'Homepage',
    'action' => 'default',
));
$container->router[] = new Route('admin/forum/<presenter><action>', array(
    'module' => 'Forum:Admin',
    'presenter' => 'Homepage',
    'action' => 'default',
));
$container->router[] = new Route('admin/<presenter><action>', array(
    'module' => 'Admin:Admin',
    'presenter' => 'Homepage',
    'action' => 'default',
));


// Front
$container->router[] = new Route('forum/<presenter><action>', array(
    'module' => 'Forum:Front',
    'presenter' => 'Homepage',
    'action' => 'default',
));
$container->router[] = new Route('<presenter>/<action>[/<id>]', 'Cms:Front:Homepage:default');