The bootstrap contains a rich set of Web Components that allow you to quickly build a beautiful, fully functional website. But sometimes our site front desk does not need bootstrap, as long as the management background using bootstrap, then how to separate for a module loading bootstrap?
Here are 4 ways to accomplish this:
1. Add the following (protected/config/main.php) to the application's configuration file:
Php
The code is as follows |
Copy Code |
' Modules ' =>array ( ' Admin ' =>array ( ' Preload ' =>array ('bootstrap'), ' Components ' =>array ( 'bootstrap' =>array ( ' Class ' = ' Ext.bootstrap.components.Bootstrap ' ) ), // ... Other modules ... )
|
2. Load on module initialization:
The code is as follows |
Copy Code |
Public Function init () { Import the Module-level models and components $this->setimport (Array ( ' Admin.models.* ', ' Admin.components.* ', ' Ext.bootstrap.components.Bootstrap ',//This'll go to app config for components )); Yii::app ()->getcomponent (' Bootstrap ');//This does the loading } |
3. Another method of module initialization loading:
The code is as follows |
Copy Code |
Php Public Function init () { Import the Module-level models and components $this->setimport (Array ( ' Admin.models.* ', ' Admin.components.* ', )); $this->configure (Array ( ' Components ' =>array ( ' Bootstrap ' =>array ( ' Class ' = ' Ext.bootstrap.components.Bootstrap ' ) ) )); $this->getcomponent (' Bootstrap '); } |
4. Another way to load the module:
The code is as follows |
Copy Code |
Php Public Function init () { Import the Module-level models and components $this->setimport (Array ( ' Admin.models.* ', ' Admin.components.* ', )); $this->configure (Array ( ' Preload ' =>array (' Bootstrap '), ' Components ' =>array ( ' Bootstrap ' =>array ( ' Class ' = ' Ext.bootstrap.components.Bootstrap ' ) ) )); $this->preloadcomponents (); } |
http://www.bkjia.com/PHPjc/631525.html www.bkjia.com true http://www.bkjia.com/PHPjc/631525.html techarticle The bootstrap contains a rich set of Web Components that allow you to quickly build a beautiful, fully functional website. But sometimes our website front desk does not need bootstrap, only ...