Yii框架官方指南系列34——扩展Yii:使用扩展
2014-11-07 00:00
731 查看
适用扩展通常半酣了以下三步:
从 Yii 的 扩展库 下载扩展.
解压到 应用程序的基目录 的子目录 extensions/xyz 下,这里的 xyz 是扩展的名称.
导入, 配置和使用扩展.
每个扩展都有一个所有扩展中唯一的名称标识.把一个扩展命名为 xyz ,我们也可以使用路径别名定位到包含了 xyz 所有文件的基目录.
不同的扩展有着不同的导入,配置,使用要求.以下是我们通常会用到扩展的场景,按照他们在 概述 中的描述分类.
1. Zii 扩展
Before we start describing the usage of third-party extensions, we would like to introduce the Zii extension library, which is a set of extensions developed by the Yii developer team and included in every release since Yii version 1.1.0. The Zii library is hosted as a Google project called zii.
When using a Zii extension, one must refer to the corresponding class using a path alias in the form of zii.path.to.ClassName. Here the root alias zii is predefined by Yii. It refers to the root directory of the Zii library. For example, to use CGridView, we would use the following code in a view script when referring to the extension:
从 Yii 的 扩展库 下载扩展.
解压到 应用程序的基目录 的子目录 extensions/xyz 下,这里的 xyz 是扩展的名称.
导入, 配置和使用扩展.
每个扩展都有一个所有扩展中唯一的名称标识.把一个扩展命名为 xyz ,我们也可以使用路径别名定位到包含了 xyz 所有文件的基目录.
不同的扩展有着不同的导入,配置,使用要求.以下是我们通常会用到扩展的场景,按照他们在 概述 中的描述分类.
1. Zii 扩展
Before we start describing the usage of third-party extensions, we would like to introduce the Zii extension library, which is a set of extensions developed by the Yii developer team and included in every release since Yii version 1.1.0. The Zii library is hosted as a Google project called zii.
When using a Zii extension, one must refer to the corresponding class using a path alias in the form of zii.path.to.ClassName. Here the root alias zii is predefined by Yii. It refers to the root directory of the Zii library. For example, to use CGridView, we would use the following code in a view script when referring to the extension:
$this->widget('zii.widgets.grid.CGridView', array( 'dataProvider'=>$dataProvider, ));
相关文章推荐
- Yii框架官方指南系列36——扩展Yii:使用第三方库
- Yii框架官方指南系列25——使用数据库:Active Record
- Yii框架官方指南系列33——扩展Yii:概览
- Yii框架官方指南系列49——专题:使用非主流模板语法
- Yii框架官方指南系列17——使用表单:创建模型
- Yii框架官方指南系列26——使用数据库:关系型 Active Record
- Yii框架官方指南系列23——使用数据库:数据访问对象(DAO)
- Yii框架官方指南系列22——使用数据库:概览
- Yii框架官方指南系列19——使用表单:创建表单
- Yii框架官方指南系列20——使用表单:批量收集表格输入
- Yii框架官方指南系列35——扩展Yii:创建扩展
- Yii框架官方指南系列24——使用数据库:Query Builder
- Yii框架官方指南系列16——使用表单:概览
- Yii框架官方指南系列增补版27——使用数据库:数据库迁移
- Yii框架官方指南系列21——使用表单:使用表单生成器(CForm)
- Yii框架官方指南系列18——使用表单:创建动作
- Yii框架官方指南系列30——缓存:片段缓存(Fragment Caching)
- Yii框架官方指南系列7——基础知识:控制器
- Yii框架官方指南系列15——基础知识:最佳MVC实践
- Yii框架官方指南系列28——缓存:概览