2012-09-11 11 views

उत्तर

2

यह पहले से ही करता है। CWebModule में इस के माध्यम से-> सेटकंपोनेंट्स निम्नानुसार हैं:

<?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

ऐसा करने का तरीका मुख्य के पैराम आइटम में आपके मॉड्यूल/आदि के लिए एक सरणी आइटम बनाना है कॉन्फ़िगरेशन सरणी इस मंच पोस्ट पर

देखो: http://www.yiiframework.com/forum/index.php/topic/24617-custom-configuration/

अगर आप अपने विन्यास एक अलग फाइल में रहना चाहता हूँ आप कॉन्फ़िग फ़ाइल में मुख्य config सरणी के साथ मर्ज कर सकते हैं! कुछ इस तरह काम करना चाहिए:

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 तर्क यह भी मुख्य config से गुण के ऊपर लिख देगा के रूप में अपने कस्टम config सरणी डाल दिया।

1

मैं इसे कभी नहीं किया है, लेकिन:

  • एक मौजूदा समाधान a wiki article में प्रदान की जाती है।
  • इस 'फीचर अनुरोध' के संबंध में, यह कोई आश्चर्य की बात नहीं है कि यह पहले ही वाईआई के मंचों पर अनुरोध किया गया था। here और here देखें।
संबंधित मुद्दे