最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Yii中单独为module加载Bootstrap或其他组件的4种方法
时间:2013-08-01 编辑:简简单单 来源:一聚教程网
这里有4中方法来实现这个:
1.在应用的配置文件中添加如下内容 (protected/config/main.php):
PHP
代码如下 | 复制代码 |
'modules'=>array( 'admin'=>array( 'preload'=>array('bootstrap'), 'components'=>array( 'bootstrap'=>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.模块初始化加载的另一种方法:
代码如下 | 复制代码 |
PHP $this->configure(array( |
4.模块加载时的另一种方法:
代码如下 | 复制代码 |
PHP $this->configure(array( |
-
上一个: Php入门教程之PHP 变量基本语法
-
下一个: PHP安装mbstring扩展模块详解
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24