Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework] Moduł + host route
Ikky
post
Post #1





Grupa: Zarejestrowani
Postów: 120
Pomógł: 1
Dołączył: 5.07.2009

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


Witam

Moja aplikacja wygląda tak:

application
config
controllers
modules
admin
test

teraz sciezka do modułów wygląda tak:

http://www.strona.pl/admin/index/akcja
http://www.strona.pl/test/index/akcja

Moim celem jest osiągnięcie czegoś takiego:

http://admin.strona.pl/index/akcja
http://test.strona.pl/index/akcja

W katalogu application mam bootstrapa oto jego kod:

  1. <?php
  2.  
  3. class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
  4. {
  5. protected function _initAutoload()
  6. {
  7. $autoloader = new Zend_Application_Module_Autoloader(array(
  8. 'namespace' => 'Default',
  9. 'basePath' => dirname(__FILE__)
  10. )
  11. );
  12.  
  13. $front = Zend_Controller_Action::getFrontController();
  14. $router = $front->getRouter();
  15.  
  16.  
  17. $admin = new Zend_Controller_Router_Route_Hostname(
  18. 'admin.strona.pl',
  19. array('module' => 'admin')
  20. );
  21.  
  22. $plainPathRoute = new Zend_Controller_Router_Route_Static(
  23. 'admin',
  24. 'module' => 'admin',
  25. 'controller' => 'index',
  26. 'action' => 'index'
  27. ));
  28.  
  29. $router->addRoute('admin', $admin->chain($plainPathRoute));
  30.  
  31.  
  32. return $autoloader;
  33. }
  34. }
  35.  
  36.  
  37.  


Co jest nie tak?

dodatkowo moge powiedzieć że jak zrobie tak:

  1.  
  2. $router->addRoute('admin',new Zend_Controller_Router_Route_Hostname(
  3. 'admin.strona.pl',
  4. array('module' => 'admin')));


to admin.strona.pl działa ale po wpisaniu np
admin.strona.pl/nazwainnegokontrolera - nie działa

Ten post edytował Ikky 30.09.2009, 10:39:37
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 20.08.2025 - 07:51