1.04 Modules

I know 1.04 isn't out yet, but I got the latest from SVN.

My Modules don't work anymore.



Missing argument 1 for VideoModule::init(), called in C:xampplitehtdocsyii1frameworkbaseCModule.php on line 78 and defined


Source File





C:xampplitehtdocsyii1webrootflocmsprotectedmodulesvideoVideoModule.php(11)





00001: <?php


00002: 


00003: class VideoModule extends FloWebModule


00004: {





00009:     public $assetsPath;


00010:     


00011: public function init($config)


00012:     {


00013:         parent::init($config);


00014:         // this method is called when the module is being created


00015:         // you may place code here to customize the module or the application


00016:         


00017:         Yii::import('application.modules.video.models.*');


00018:         


00019:         Yii::app()->params['currentContentType'] = 'Video';


00020:         


00021:     }


00022: }








What is the new way to work with modules and what has changed? 


I changed line 78 of CModule.php from $this->init() to $this->init($config).  Not sure if that's correct but it works.  Please confirm or provide correct fix.  Thanks!

Yes, that's correct. The change is described in UPGRADE.

Hi,

00011: public function init($config)


00012:     {


00013:         parent::init($config);


00014:         // this method is called when the module is being created


00015:         // you may place code here to customize the module or the application


00016:         


00017:         Yii::import('application.modules.video.models.*');


00018:         


00019:         Yii::app()->params['currentContentType'] = 'Video';


00020:         


00021:     }


00022: }

this is mandatory to load models?



Yii::import('application.modules.video.models.*');


It is not mandatory. Using it makes your life easier so that you don't have to explicitly include/import a model class before using it in a module.

nice,

here we can add params for module 'ambient loadded'

like



public function init($config)


    {


      parent::init($config);


      Yii::import('application.modules.blog.models.*');


      Yii::app()->params['postperpage'] = '10';


      Yii::app()->params['showHelp'] = 'false';


      Yii::app()->params['guestcanpost'] = 'true';


}





or like



class BlogModule extends CWebModule


{


public function init('file.php')


where file.php content an array config?

regards