I just want to know if we can add a config file that extends the main.conf in the module
It does, already. in the CWebModule through $this->setComponents as follows:
<?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.*',
));
}
} ?>
The way to do it is to make an array item for your module/etc in the params item of the main config array.
Look at this forum post: http://www.yiiframework.com/forum/index.php/topic/24617-custom-configuration/
if you want your configuration to be in a separate file you can merge it with the main config array in the config file! something like this should work:
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
);
If you put your custom config array as the 2nd argument it will also overwrite attributes from the main config.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With