Yii中单独为module加载Bootstrap或其他组件的4种方法
来源:互联网 发布:苹果电脑的软件 编辑:程序博客网 时间:2024/06/04 19:11
Bootstrap中包含了丰富的Web组件,根据这些组件,可以快速的搭建一个漂亮、功能完备的网站。
但是有时候我们网站前台并不需要Bootstrap,只要管理后台使用Bootstrap,那么该如何单独为一个module加载Bootstrap呢?
这里有4中方法来实现这个:
1.在应用的配置文件中添加如下内容 (protected/config/main.php):
'modules'=>array( 'admin'=>array( 'preload'=>array('<span class='wp_keywordlink_affiliate'><a href="http://lxy.me/tag/bootstrap" title="查看bootstrap中的全部文章" target="_blank">bootstrap</a></span>'), 'components'=>array( '<span class='wp_keywordlink_affiliate'><a href="http://lxy.me/tag/bootstrap" title="查看bootstrap中的全部文章" target="_blank">bootstrap</a></span>'=>array( 'class'=>'ext.bootstrap.components.Bootstrap' ) ), // ...其他模块... )
2.在模块初始化时加载:
public function init() { // import the module-level models and components $this->setImport(array( 'admin.models.*', 'admin.components.*', // 'ext.bootstrap.components.Bootstrap', // this will go to app config for components )); Yii::app()->getComponent('bootstrap');// this does the loading }
3.模块初始化加载的另一种方法:
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.模块加载时的另一种方法:
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://lxy.me/yii-separate-module-load-components.html
0 0
- Yii中单独为module加载Bootstrap或其他组件的4种方法
- Yii中单独为module加载Bootstrap或其他组件的4种方法
- Yii中单独为module加载Bootstrap或…
- bootstrap修改默认字体,更换为微软雅黑或其他字体的方法
- bootstrap修改默认字体,更换为微软雅黑或其他字体的方法
- 如何在指定的动作中加载 Yii-bootstrap 扩展
- bootstrap表单的其他组件
- bootstrap表单的其他组件
- yii中yii-bootstrap的使用
- Android 解决ScrollView滑动过程中单独用ScrollTo()或单独smoothScrollTo()方法不起作用的问题
- div中加载其他网页的方法
- Yii控制器调用其他控制器的方法
- Yii控制器调用其他控制器的方法
- Yii 中引用bootstrap
- RCP中获得其他view或editor引用的方法
- 为Yii bootstrap当中的TbDropDown 添加html属性
- Bootstrap其他内置组件(一)
- Bootstrap其他内置组件(二)
- 日志级别
- Hibernate hql 查询指定字段并获取结果集
- LeetCode | Word Break II
- 逃离北上广:你以为回到小城市就很幸福了吗?
- 使用Objective-C解压缩ZIP文件教程
- Yii中单独为module加载Bootstrap或其他组件的4种方法
- 进程工作目录
- HDU 4964 Emmet 模拟
- Memset、Memcpy、Strcpy 的作用和区别(转)
- 查看某个数据文件上的对象
- 百万级PHP网站架构工具箱,高并发架构方案
- fstream,FILE之间的选择
- C中strstr()
- struct和typedef struct、enum与typedef enum、链表与结构体的区别(转载)