Codeigniter类模块之间的继承(wiredesigns) [英] Codeigniter Class Inheritance between modules (wiredesigns)

查看:94
本文介绍了Codeigniter类模块之间的继承(wiredesigns)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My CI2 app is using the wiredesigns modular layout.

我有一个名为项目和产品的文件夹中的模块,如下所示:

I have a two modules called item and product in a a folder called modules like so:

/application
    /modules
        /item
        /product

在项目中,我有一个名为item的控制器,启动方式如下。

In Item I have a controller called item which starts like this.

class Item extends MX_Controller
{
    //code here
}


b $ b

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

What do I need to do to make my products controller extend my item controller in a different module

推荐答案

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

My guess is you are trying to keep your code "DRY" (http://en.wikipedia.org/wiki/Don't_repeat_yourself) which in CI means using a common controller like a My_Controller (see: 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

Check out Phil Sturgeon's take: http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY.

这篇关于Codeigniter类模块之间的继承(wiredesigns)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆