模块之间的编码器类继承(wiredesigns)


Codeigniter Class Inheritance between modules (wiredesigns)

我的CI2应用程序使用的是wiredesigns模块化布局。

我在一个名为modules的文件夹中有两个名为item和product的模块,如下所示:

/application
    /modules
        /item
        /product

在Item中,我有一个名为Item的控制器,它的开头是这样的:

class Item extends MX_Controller
{
    //code here
}

我需要做些什么来使我的产品控制器扩展我的项目控制器在一个不同的模块

我的猜测是你试图保持你的代码"DRY" (http://en.wikipedia.org/wiki/Don't_repeat_yourself),这在CI意味着使用一个像My_Controller(见:http://ellislab.com/codeigniter/user-guide/general/core_classes.html)的通用控制器。

查看Phil Sturgeon的观点:http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY.