Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework] Zend_Router
UDAT
post
Post #1





Grupa: Zarejestrowani
Postów: 442
Pomógł: 0
Dołączył: 27.12.2005

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


Jak ustawić Zend_Router aby nie odnosił mi się do ROOT_DIR serwera.

Dałem plik .htaccess do katalogu ROOT_DIR/subdir
Mam też odpowiednią strukturę , ale ciągle odnosi się do ROOT'_DIRa.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
envp
post
Post #2





Grupa: Zarejestrowani
Postów: 359
Pomógł: 1
Dołączył: 16.04.2006
Skąd: Łódź

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


troche przerobiony (działający router zenda):

  1. <?php
  2. public function __construct()
  3. {
  4. $this->_sURI = $this->_formatQuery();
  5. }
  6.  
  7. private function _formatQuery(){
  8. return substr($_SERVER['REQUEST_URI'],strlen($_SERVER['SCRIPT_NAME'])-9,strlen($_SERVER['REQUEST_URI']));
  9. }
  10.  
  11. public function route()
  12. {
  13.  
  14. if (strstr($this->_sURI, '?')) {
  15. $this->_sURI = substr($this->_sURI, 0, strpos($this->_sURI, '?'));
  16. }
  17. $this->_aParams = explode('/', trim($this->_sURI, '/'));
  18. $this->_sCtrlName = $this->_aParams[0];
  19. $this->_sActName = isset($this->_aParams[1]) ? $this->_aParams[1] : null;
  20.  
  21. if (!strlen($this->_sCtrlName))
  22. {
  23. $this->_sCtrlName = _DEFAULT_CTRL_NAME;
  24. $this->_sActName = _DEFAULT_ACT_NAME;
  25. }
  26.  
  27.  
  28.  
  29.  $aActParams = array();
  30.  for ($i=2; $i<sizeof($this->_aParams); $i=$i+2) {
  31.  $aActParams[$this->_aParams[$i]] = isset($this->_aParams[$i+1]) ? $this->_aParams[$i+1] : null;
  32.  }
  33.  
  34.  
  35.  $oCurrentAction = new DispatcherToken($this->_sCtrlName, $this->_sActName, $aActParams);
  36.  
  37.  return $oCurrentAction;
  38.  
  39. }
  40. ?>
Go to the top of the page
+Quote Post
UDAT
post
Post #3





Grupa: Zarejestrowani
Postów: 442
Pomógł: 0
Dołączył: 27.12.2005

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


Cytat(envp @ 27.10.2006, 21:37:24 ) *
troche przerobiony (działający router zenda):

  1. <?php
  2. public function __construct()
  3. {
  4. $this->_sURI = $this->_formatQuery();
  5. }
  6.  
  7. private function _formatQuery(){
  8. return substr($_SERVER['REQUEST_URI'],strlen($_SERVER['SCRIPT_NAME'])-9,strlen($_SERVER['REQUEST_URI']));
  9. }
  10.  
  11. public function route()
  12. {
  13.  
  14. if (strstr($this->_sURI, '?')) {
  15. $this->_sURI = substr($this->_sURI, 0, strpos($this->_sURI, '?'));
  16. }
  17. $this->_aParams = explode('/', trim($this->_sURI, '/'));
  18. $this->_sCtrlName = $this->_aParams[0];
  19. $this->_sActName = isset($this->_aParams[1]) ? $this->_aParams[1] : null;
  20.  
  21. if (!strlen($this->_sCtrlName))
  22. {
  23. $this->_sCtrlName = _DEFAULT_CTRL_NAME;
  24. $this->_sActName = _DEFAULT_ACT_NAME;
  25. }
  26.  $aActParams = array();
  27.  for ($i=2; $i<sizeof($this->_aParams); $i=$i+2) {
  28.  $aActParams[$this->_aParams[$i]] = isset($this->_aParams[$i+1]) ? $this->_aParams[$i+1] : null;
  29.  }
  30.  $oCurrentAction = new DispatcherToken($this->_sCtrlName, $this->_sActName, $aActParams);
  31.  
  32.  return $oCurrentAction;
  33.  
  34. }
  35. ?>


Nie działa.

Choćby _DEFAULT_ACT_NAME i _DEFAULT_CTRL_NAME jest niezdefiniowane oraz metoda route nie jest zgodna z interfejsem.

Ten post edytował UDAT 28.10.2006, 10:12:11
Go to the top of the page
+Quote Post

Posty w temacie


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: 10.10.2025 - 18:56