2012-12-10 2 views
0

내 URL에 .htm과 같은 확장자를 사용하고 싶습니다. 그것을 성취 할 수있는 방법이 있습니까?젠드 프레임 워크에서 확장 기능을 사용하는 방법 라우팅

나는 다음과 같은 규칙을 정의했습니다 :

frontend.route = '/:standort/:id' 

내가 다음

frontend.route = '/:standort/:id.htm' 

다음 변수의 이름은 사용할 때 id.htm은 $ PARAMS처럼를 [ "id.htm "]. Zend Framework에게 변수로 사용할 것을 어떻게 알 수 있습니까?

인사말

// 편집

내 전체 설정은 이제 다음과 같습니다

frontend.type = 'Zend_Controller_Router_Route_Regex' 
frontend.route = '/(.?)/(\w+?\.htm)' 
frontend.defaults.module = 'frontend' 
frontend.defaults.controller = 'index' 
frontend.defaults.action = 'index' 
frontend.defaults.standort = 'national' 
frontend.map.1 = 'standort' 
frontend.map.2 = 'id' 

이 내가 설정

$file = APPLICATION_PATH . '/modules/' . $module . '/configs/routing.ini'; 

     if(Zend_Loader::isReadable($file)){ 
      $config = new Zend_Config_Ini($file); 
      $router = Zend_Controller_Front::getInstance()->getRouter(); 
      $router->addConfig($config); 
     }   
를로드하는 방법입니다 당신은이 작업을 수행 할 수

답변

0

정규식 경로 :

frontend.type = "Zend_Controller_Router_Route_Regex" 
frontend.route = '/(.?)/(\w+?\.htm)' 
frontend.map.1 = "standort" 
frontend.map.2 = "id" 

기존 URL 구조를 유지하려고하지 않는 한 .htm을 그대로두면 아무 목적도 없습니다.

+0

감사합니다. 그러나 작동하지 않습니다. getRoutes()가 올바른 설정을 반환하고 이전 설정을 덮어 쓰더라도 표준 경로가 사용됩니다. – jantoenjes

+0

자세한 정보를 제공해 주시겠습니까? '받아 들일 수 없다'고 말하면 오류가 있습니까? 전체 설정 파일은 어떻게 생겼으며이 경로를로드하고 있습니까? –

+0

젠장, 너 빠르다) – jantoenjes