application default module

This topic explains how to set up a default route to a module, for example, you can set a default controller, but what if you only have 3 modules and no controllers outside the modules?

This is pretty easy once you know how, but there’s nothing out there explaining how to do it, so I spent more time than I wanted to make it work and decided to post here so it will save others people time

So here it is, just define the ‘defaultController’ variable routing to a module for example:




return array(

	'basePath'=>APP_PATH,

	//...

   'defaultController'=>'app/site',

);



pretty simple huh

hope it saves some of time

Cool,so module like develop pattern is a better practice of Yii . :rolleyes:

Yes, setting initial redirect to a module CmsModule can be achieved via setting in configuratin main.php:




return array(

   'basePath'=>APP_PATH,

   //...

   'defaultController'=>'cms',

   //...

);



This will load CmsModule and redirect to its default controller. If standard CmsController exists, the module takes precedence and CmsController is ignored.

yes i find it very effective. thanks a lot Dear Gustavo.

with love

bipu

Thank you.