I'm try to load the Yii Bootstrap extension in the admin module only but it's not working. I'm assuming I need to preload it or initiate it somehow... Thanks!
class AdminModule extends CWebModule
{
public function init()
{
// import the module-level models and components
$this->setImport(array(
'admin.models.*',
'admin.components.*',
'ext.bootstrap.components.Bootstrap',
));
}
public function beforeControllerAction($controller, $action)
{
if(parent::beforeControllerAction($controller, $action))
{
$this->layout = 'admin';
return true;
}
else
return false;
}
}
Really working code : in your module init function just paste the following code :
When you configure the following in the main config (protected/config/main.php), example as:
Then, you can using component as
To define this module component to main component, you must to set Component in init() of Module class:
Preload it in the init :
If it doesn't work then paste your url into that file, which form you are using bootstrap
There are 4 different ways to do this:
Add the configuration to the app's configuration (protected/config/main.php):
Preload it in the
init
:Preload in
init
another way:Preload in
init
yet another way: