Routovanie v module – admin a front sekcia bez rozdelenia na podadresare
- xrep
- Člen | 51
Ahoj,
predpokladajme ze mam modul v app/EshopModule, ktory obsahuje klasicky
model, presenters,templates.
V tychto adresaroch mam presentery ktore su spolocne aj pre Admin aj pre Front
cast eshopu.
Router mam nastaveny
$router[] = new Route('/admin/eshop/<presenter>/<action>/<id>', array(
'module' => 'Eshop',
'presenter' => 'Dashboard',
'action' => 'default',
'id' => NULL,
));
$router[] = new Route('/admin/<presenter>/<action>/<id>', array(
'module' => 'Admin',
'presenter' => 'Dashboard',
'action' => 'dashboard',
'id' => NULL,
));
$router[] = new Route('[<locale=en [a-z]{2}>/]eshop/<presenter>/<action>/<id>[/<slug>]', array(
'module' => 'Eshop',
'presenter' => 'Home',
'action' => 'default',
'id' => NULL
));
$router[] = new Route('[<locale=en [a-z]{2}>/]<presenter>/<action>/<id>[/<slug>]', array(
'module' => 'Front',
'presenter' => 'Homepage',
'action' => 'default',
'id' => NULL
));
Problem je ze mi potom aj na frontende n:href=:Eshop:Home:default generuje
linku http://domena.tld/admin/eshop/… co je neziaduce.
V podstate nemam modul rozdeleny na AdminModule a FrontModule, mam to vsetko
v EshopModule, a dla prveho pravidla sa mi potom generuju linky aj pre frontend
aj backend.
Ako to osetrit?
Pozeral som forum a nasiel som nieco ako:
new Route('/admin/eshop/<presenter (Dashboard) >/<action>/<id>', array(
'module' => 'Eshop',
'presenter' => 'Dashboard',
'action' => 'default',
'id' => NULL,
));
co to (Dashboard) znamena? Nenasiel som to zdokumentovane, resp. ale robi to to co potrebujem, da sa to nejako aplikovat na viacero prezenterov, tzn prezentery z admin casti?
Vdaka
- xrep
- Člen | 51
Zatial som to vyriesil „natvrdo“
$router[] = new Route('/admin/eshop/manage-orders/<action>/<id>', array(
'module' => 'Eshop',
'presenter' => 'ManageOrders',
'action' => 'default',
'id' => NULL,
));
$router[] = new Route('/admin/eshop/<action>/<id>', array(
'module' => 'Eshop',
'presenter' => 'Dashboard',
'action' => 'default',
'id' => NULL,
));
$router[] = new Route('/admin/<presenter>/<action>/<id>', array(
'module' => 'Admin',
'presenter' => 'Dashboard',
'action' => 'dashboard',
'id' => NULL,
));
$router[] = new Route('[<locale=en [a-z]{2}>/]eshop/<presenter>/<action>/<id>[/<slug>]', array(
'module' => 'Eshop',
'presenter' => 'Home',
'action' => 'default',
'id' => NULL
));
$router[] = new Route('[<locale=en [a-z]{2}>/]<presenter>/<action>/<id>[/<slug>]', array(
'module' => 'Front',
'presenter' => 'Homepage',
'action' => 'default',
'id' => NULL
));
ale to neni najvhodnejsie :/