Použitie Route::SECURED na moduly

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

V aplikácii mám moduly Admin, Moder, User a Front. Moduly Admin a Moder mám cez https. Všetko funguje takmer tak ako má, niekedy mám pri routovaní problémy. Dá sa routa napísať inak, prípadne jednoduchšie?

// Setup router
$router = $container->router;
$router[] = new Route('admin/<presenter>/[<action>][/<id=>]', array(
                        'module' => 'Admin',
                        'action' => 'default',
                        'id'     => null), Route::SECURED);
$router[] = new Route('member/<presenter>/[<action>][/<id=>]', array(
                        'module' => 'Moder',
                        'action' => 'default',
                        'id'     => null), Route::SECURED);
$router[] = new Route('<presenter>/<action>[/<id [0-9]+>]', array(
                        'module'    => 'Front',
                        'presenter' => 'Hladanie',
                        'action'    => 'default',
                        'id'        => null,
                      ));
$router[] = new Route('<module>/<presenter>/<action>[/<id>][/<id2>]');

Trošku viac som sa na to pozrel a vyskúšal toto:

$router = $container->router;
$router[] = new Route('<module admin|member>[/<presenter>][/<action>][/<id=>]', array(
                        'module' => array(
                          Route::FILTER_TABLE => array(
                            'admin'  => 'Admin',
                            'member' => 'Moder')),
                        'presenter'  => 'Default',
                        'action' => 'default',
                        'id'     => null), Route::SECURED);
$router[] = new Route('module user/<presenter>[/<action>][/<id=>][/<id2>]', array(
                        'module' => 'User',
                        'action' => 'default',
                        'id'     => null));
$router[] = new Route('<presenter>[/<action>][/<id [0-9]+>]', array(
                        'module'    => 'Front',
                        'presenter' => 'Hladanie',
                        'action'    => 'default',
                        'id'        => null,
                      ));

Editoval Jamicon (9. 6. 2012 18:55)