Modulová štruktúra – nastavenie
- Peter9
- Člen | 69
Mám Nete 2.0 (php 5.3/alfa 2) a rád by som nejak nakonfiguroval modulovú štruktúru (FrontEnd a BackEnd = teda Administrácia a to ostatné)…
https://doc.nette.org/…n/presenters
Problém je, že z toho návodu som jemne grogy…
- Peter9
- Člen | 69
okik…
///EDIT! :
ale: nefunguje mi routing na back-end – hľadá presenter v FrontEnde
(navyše hľadá AdministrationPresenter.php) …
Teda presnejšie: Použil som kód z Modules-Usage…
if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()))
{
$router[] = new Route('index.php', 'FrontEnd:Homepage:default', Route::ONE_WAY);
$router[] = $adminRouter = new MultiRouter('BackEnd'); // also Administration
$adminRouter[] = new Route('admininstration/[<presenter>/<action>]', 'Homepage:default');
$router[] = $frontRouter = new MultiRouter('FrontEnd');
$frontRouter[] = new Route('<presenter>/<action>/<id>]', 'Homepage:default');
} else { $router[] = new SimpleRouter('FrontEnd:Homepage:default'); }
A malo by to fungovať analogicky. Niečo som asi prehliadol…
/// EDIT:
Napadlo ma regexp.
Editoval Peter9 (13. 2. 2011 18:24)
- Chbox
- Člen | 125
Musíš uvést i modul:
$adminRouter[] = new Route('admininstration/<modul>/[<presenter>/<action>]', 'Admin:Homepage:default');
hledej tady na foru nebo se podivej do tutoriálů, tady od Sirgiho mas moduly i ACL k tomu: https://doc.nette.org/…thentication
Editoval Chbox (13. 2. 2011 18:34)
- Peter9
- Člen | 69
Ni. Vyšla mi z toho ešte väčšia somarina:
Cannot load presenter 'FrontEnd:Administration:FrontEnd:Homepage', class 'FrontEndModule\AdministrationModule\FrontEndModule\HomepagePresenter' was not found in
Tak z tohoto som na vetvy :D :D :D
if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()))
{
$router[] = new Route('index.php', 'FrontEnd:Homepage:default', Route::ONE_WAY);
$router[] = $adminRouter = new MultiRouter('BackEnd'); // also Administration
$adminRouter[] = new Route('admininstration/<module>/[<presenter>/<action>]', 'BackEnd:Homepage:default');
$router[] = $frontRouter = new MultiRouter('FrontEnd');
$frontRouter[] = new Route('<module>/<presenter>/<action>/[<id>]', 'FrontEnd:Homepage:default');
} else { $router[] = new SimpleRouter('FrontEnd:Homepage:default'); }
Mám štruktúru:
app/
BackEndModule/
presenters/
templates/
FrontEndModule/
presenters/
templates/
A potreboval by som, aby adresa vyzerala: http://addr.com/administration/<>/<> alebo http://addr.com/cat/cat2/topic
Editoval Peter9 (13. 2. 2011 19:16)