2012-09-11 3 views

답변

2

이미 있습니다. CWebModule에서 $ this-> setComponents를 통해 다음과 같이 설정합니다.

<?php 

    class AccountModule extends CWebModule 
    { 
     public function init() 
     { 
      // this method is called when the module is being created 
      // you may place code here to customize the module or the application 

      $this->setComponents(array(
       'errorHandler' => array(
         'errorAction' => 'module/default/error'), 
       'defaultController' => 'default', 
       'user' => array(
         'class' => 'ModuleWebUser', 
         'allowAutoLogin'=>true, 
         'loginUrl' => Yii::app()->createUrl('module/default/login'), 
       ) 
      )); 

      // import the module-level models and components or any other components.. 
      $this->setImport(array(
       'module.models.*', 
       'module.components.*', 
      )); 
     } 
} ?> 
1

기본 모듈의 params 항목에 모듈/etc에 대한 배열 항목을 만드는 방법이 있습니다 구성 배열. 이 포럼 게시물에

봐 : http://www.yiiframework.com/forum/index.php/topic/24617-custom-configuration/

당신이 당신의 구성이 별도의 파일에있을하려는 경우 설정 파일의 주요 구성 배열을 병합 할 수 있습니다! 이 같은 뭔가 작업을해야합니다 :

include("custom_config.php"); // define $array_from_custom_conf inside this file 
return array_merge(
    array(/*main_config_array from main.php*/), 
    $array_from_custom_conf 
); 

을 당신이 또한 기본 설정의 속성을 덮어 쓰게됩니다 2 인자로 사용자 정의 설정 배열을 넣어합니다.

1

나는 그것을하지 않았다하지만 적이 :

  • 현재 솔루션은 a wiki article에 제공됩니다.
  • 이 '기능 요청'에 대해서는 Yii의 포럼에서 이미 요청한 것이 놀랄 일이 아닙니다. herehere을 참조하십시오.
관련 문제