Witam napisałem taką klasę routingu
<?php
class Application_Routing_Data implements Application_Routing_Data_Interface {
public function __construct() {
$sUrl = $this->removeApplicationPathName();
/* Ustawienie domyślnych wartości parametrów */
$this->setParameters('Module', null, null);
$this->setParameters('Action', null, null);
$this->setParameters('Value', null, null);
$this->parseApplicationUrl($sUrl);
}
/* Metoda usuwająca z adresu url nazwę katalogu strony */
private function removeApplicationPathName() {
$str = explode(APP_WEB_PATH
, $_SERVER['REQUEST_URI']); return $str[1];
}
/* Metoda parsująca adres url */
private function parseApplicationUrl($sUrl) {
$counter = 0;
/* Stworzenie składowej tablicy dla pierwszych zmiennych adresu URL */
if(preg_match('/[a-zA-z0-9]+[\-|\,]/', $str[1
])) { foreach($aStr as $value) {
$aStr[$counter] = explode('-', $value); $counter++;
}
for($i = 0; $i < count($aStr); $i++) { $this->setParameters('Value', $aStr[$i][0], $aStr[$i][1]);
}
/* Stworzenie tablicy parametrów dla adresu URL moduł/akcja/zmienne */
} else {
$this->setParameters('Module', null, $str[0]);
$this->setParameters('Action', null, $str[1]);
foreach($aStr as $value) {
$aStr[$counter] = explode('-', $value); $counter++;
}
for($i = 0; $i < count($aStr); $i++) { $this->setParameters('Value', $aStr[$i][0], $aStr[$i][1]);
}
}
}
/* Metody dostępu */
public function setParameters($sFirstIndexName = null, $sSecondIndexName = null, $value = null) {
if($sFirstIndexName != null && $sSecondIndexName == null) {
$this->_aParameters[$sFirstIndexName] = $value;
} else if($sFirstIndexName != null && $sSecondIndexName != null) {
$this->_aParameters[$sFirstIndexName][$sSecondIndexName] = $value;
}
}
public function getParameters($sFirstIndexName = null, $sSecondIndexName = null) {
if($sFirstIndexName != null && $sSecondIndexName != null) {
return $this->_aParameters[$sFirstIndexName][$sSecondIndexName];
} else if($sFirstIndexName != null && $sSecondIndexName == null) {
return $this->_aParameters[$sFirstIndexName];
} else if($sFirstIndexName == null && $sSecondIndexName == null) {
return $this->_aParameters;
}
}
/* Prywatne składowe */
private $_aParameters;
}
?>
Przy wpisaniu url:
http://localhost/CMS/administrator/slowaKluczowe strona wyświetla się normalnie jednak po podaniu zmiennych w url:
http://localhost/CMS/administrator/slowaKl...z-slowaKluczowe strona się rozsypuje, nie wiem w czym tkwi problem.
Mój .htaccess
RewriteEngine on
<IfModule mod_rewrite.c>
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /CMS/index.php [L]
</IfModule>