2012-01-31 5 views
1

기본 모듈의 디렉토리를 변경하려면 어떻게해야합니까? 나는 젠드 프레임 워크 모듈 디렉토리 구조를 사용하고 있습니다 :기본 모듈의 디렉토리를 변경하십시오.

modules 
    default 
     controllers 
      IndexController.php 
     etc 
    other-module 

을하지만 어떻게 기본 모듈의 디렉토리를 변경할 수 있습니까? 나는 그것이 Api라고 불리길 원합니다.

modules 
    Api 
     controllers 
      IndexController.php 
    other-module 

나는 URI를 그렇게 동일하게 유지하려면 : 그래서 난 것이다 모듈/API/컨트롤러/IndexController.php에

http://localhost 

윌 경로를하고 indexAction를 실행합니다.

내가 당신의 config.ini 파일

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 
resources.modules[] = "default" 
resources.modules[] = "api" 

귀하의 폴더 구조에서 부트 스트랩

protected function _initFrontController() 
{ 
    $front = Zend_Controller_Front::getInstance(); 
    $front->addModuleDirectory(APPLICATION_PATH.'/modules'); 
    return $front; 
} 
+0

나는 잘 모르겠지만 당신의 apllication.ini에서 시도해보십시오'resources.frontController.moduleDirectory = APPLICATION_PATH "/ modules/api"' – Rikesh

답변

4

괜찮 :

# where to find modules 
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" 

# set the default module 
resources.frontController.defaultModule = "api" 

# which modules to activate 
resources.modules.api = "api" 
resources.moduler.other = "other" 

다음 Bootstrap에서 _initFrontController() 방법을 삭제할 수 있습니다.

여기에 대소 문자가 있음을 유의하십시오. 일반적으로 (config 파일과 route에서 참조 된) 모듈 이름은 소문자입니다. 또한 모듈의 파일 이름은 소문자입니다 (예 : application/modules/api). 모듈 특정 클래스 이름 (예 : 관리 모듈 내의 컨트롤러)은 모듈 이름의 첫 번째 문자를 클래스 접두사 (예 : class Admin_ArticleController extends Zend_Controller_Action)로 대문자로 나타냅니다.

[하이픈과 낙타 표기법 모듈 이름 - 당신의 '다른 모듈'예와 같이 -. 내가 모듈 특정 클래스가 접두사해야 정확히 어떻게 잊어하지만 당신이 정말로 필요하면 쫓아 정도로 쉽게]

1

에 가지고있는 것은 application/config.ini에서

관련 문제