Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF] Problem z routingiem, Domyślny modół się odpala ale inne juz nie :/
orideith
post
Post #1





Grupa: Zarejestrowani
Postów: 72
Pomógł: 1
Dołączył: 21.07.2006

Ostrzeżenie: (0%)
-----


Witam mam taki problem z ZF chciałem ustawić 2 moduły jeden admin drugi domyślny, w którym miała by być strona docelowa ale niestety to niedziała.

Bootstrap wygląda tak (wycinek)

  1. <?php
  2. $base = '/';
  3. $frontController = Zend_Controller_Front::getInstance();
  4. $frontController->setBaseUrl($base);
  5. $frontController->throwExceptions(true);
  6. $frontController->setControllerDirectory(
  7. array('default' => './application/default/controllers','admin'=> './application/admin/controllers')
  8. );
  9. $route = new Zend_Controller_Router_Route( ':module/:controller/:action/*', array('module' => 'default', 'controller' => 'index', 'action' => 'index'));
  10. $route_admin = new Zend_Controller_Router_Route( ':module/:controller/:action/*', array('module' => 'admin', 'controller' => 'admin', 'action' => 'index'));
  11. $router = $frontController->getRouter();
  12. $router->addRoute('default', $route);
  13. $router->addRoute('admin', $route_admin);
  14. $frontController->setRouter($router);
  15.  
  16. // run!
  17. $frontController->dispatch();
  18. ?>


i tak jeżeli odpale http://localhost/default/index/index to odpala mi sie IndexController z katalogu /application/default/controllers/IndexController.php i tu jest ok zgodnie z opisem na http://framework.zend.com/manual/en/zend.c...routes.standard głównie punkt 7.5.4 tak jak jest opisane

ale jak chce odpalić http://localhost/admin/admin/index (gdzie jest /application/admin/controllers/AdminController.php) to dostaje błąd typu
  1. <?php
  2. Zend_Controller_Dispatcher_Exception: Invalid controller class ("Admin_AdminController") in G:wwwDentistica_cmslibraryZendControllerDispatcherStandard.php on line 353
  3.  
  4. [tak to z Xdebug wyglada]
  5.  
  6. $file = string 'AdminController.php' (length=19)
  7. $loadFile = string './application/admin/controllersAdminController.php' (length=51)
  8. $finalClass = string 'Admin_AdminController' (length=21)
  9. $dispatchDir = string './application/admin/controllers' (length=31)
  10. $className = string 'AdminController' (length=15)
  11. $dir = string './application/admin/controllers' (length=31)
  12. ?>


I teraz pytanie co jest nie tak próbowałem na wiele sposobów ale nie wiem czemu nie działa.

Będę wdzięczny za podpowiedź podejrzewam, że nie wiele trzeba tu zmienić ale nie wiem gdzie dokładnie

Ten post edytował orideith 7.07.2008, 20:36:16
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
nevt
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 595
Pomógł: 282
Dołączył: 24.09.2007
Skąd: Reda, Pomorskie.

Ostrzeżenie: (0%)
-----


prosze zmienić tagi bbcode z [code] na [php] - w obecnej postaci kod jest zupełnie nieczytelny
Go to the top of the page
+Quote Post
cckoles
post
Post #3





Grupa: Zarejestrowani
Postów: 37
Pomógł: 1
Dołączył: 2.05.2007

Ostrzeżenie: (0%)
-----


wystarczy abys ustawil front controler w ten sposob i będzie działać


  1. <?php
  2. // ustawienie kontrolera
  3. $frontController = Zend_Controller_Front::getInstance();
  4. $frontController->throwExceptions(true);
  5. $frontController->setControllerDirectory(array(
  6. 'default' => '../application/modules/default/controllers',
  7. 'admin'  => '../application/modules/admin/controllers'));
  8.  
  9. // run!
  10. $frontController->dispatch();
  11. ?>


pozniej wywolujesz dany modul tak jak napisales ale w samym kontrolerze admin musisz wstawiac prefix do nazyw klasy kontrolera Admin_NazwaKontrolera
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 08:54