用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4045|回复: 3
收起左侧

[讨论/交流] 大家来讨论Ci2.0的Packages

[复制链接]
发表于 2010-5-7 07:41:31 | 显示全部楼层 |阅读模式
Packages应该是一个比较重要的改变了。
本来我以为packages是ci用来解决hmvc做的改进,但是仔细看过之后,packages并不能实现,最起码不能直接实现HMVC。
1.因为Packages文件夹下面没有Controller/Views。
2.Packages不能用URL来激活。
3.不同的报包之间不能相互调用。

我现在只知道Packages是用来更好的区分文件夹。
手册上的解释:
Application "Packages"
An application package allows for the easy distribution of complete sets of resources in a single directory, complete with its own libraries, models, helpers, config, and language files. It is recommended that these packages be placed in the application/third_party folder. Below is a sample map of an package directory。

例如:
$this->load->add_package_path(APPPATH.'third_party/foo_bar/');
$this->load->library('foo_bar');

这样当Loader第一次找application下面的library文件夹失败的时候,就会再去找third_party/foo_bar/下面的foo_bar类库。

评分

参与人数 1威望 +2 收起 理由
Hex + 2 我很赞同

查看全部评分

 楼主| 发表于 2010-5-7 13:47:09 | 显示全部楼层
回复 1# navy92f
官方项目EE2.0中对Packages的介绍
Packages

ExpressionEngine 2.0 introduces packages for third-party add-ons, enabling all assets to be managed and updated much more simply, and making it easier to create complex add-ons with many components.
发表于 2010-5-8 12:52:49 | 显示全部楼层
这个功能实际上是用来取代1.7.X版本中那个鸡肋的plugins的。
发表于 2010-5-8 14:58:59 | 显示全部楼层
感觉和Java包机制差不多。
只不过
$this->load->add_package_path
类似于Java的 import package

本版积分规则