Yii 1.1: management-module

This ext is to dynamic management modules,you can decide whether to enable module,you can also add params by dynamic

If you want to dynamic management modules,you must need it.You can dynamically add modules with params.


Yii 1.1 or above



tar the module under protected/modules/moduleManage and modify the following to your main config

return array(

Done,you must add the modules.php in the config folder,and add the following to your modules.php

    'moduleConfigFile'=>__FILE__//config the modules folder

Last,you should create a table with module_managel.sql. Now,you should configure the commpents of db ,and sure it to connect the db.and then,you visit the yourdomain/index.php?r=moduleManage.


If step1 success ,now you can create a module. but before you create a module,you must use gii to generate the module's folder you want.if you complete it,you can click the create module tag,and write something to this form.It should be noted when you configure the module config,you must use PHP ARRAY Format,and you can use any key/value for it.

[STEP3] If step2 success,you can in your module to use these params ans status.For example:there is a testModule in my project,and open the module's config file (moduleName+Module.php)

class TestModule extends CWebModule
    public function init()
           //add hook
           //default 'status' is reserved keyword you can get it by $this->params['status']
           //you can get other cofing params by use $this->params[key]
           // such as $this->params['maintain']
            //do something here
            //do something here
        // this method is called when the module is being created
        // you may place code here to customize the module or the application
        // import the module-level models and components


my blog

Total 3 comments

#12605 report it
Abhishek Shah at 2013/04/01 03:54am
how to write array format for config

pleas give some sample.

#12328 report it
Abhishek Shah at 2013/03/14 03:27am
want some clarification

In ModuleMangeModule.php public $moduleConfigFile = ''; the variable is empty,is it required to give some path there?

#12327 report it
Abhishek Shah at 2013/03/14 02:12am
geting error

while visiting /index.php?r=moduleManage. got error Invalid argument supplied for foreach() public function setModules($modules) { foreach($modules as $id=>$module) { getting error at this foreach. It is from /var/www/yii/framework/base/CModule.php(339)

Leave a comment

Please to leave your comment.

Create extension