摘要: 观察者模式?事件允许你在不修改核心代码而将自己编写的代码到其他的代码中,因为这个是面向开发者而非终端用户,所以没有GUI来管理这些功能,取而代之的是通过修改配置文件来注册事件。保存事件数据有两种方法:使用数据库或文件。我们选用基于文件的方式。事件的注册:为了事件能够工作,首先必须在config/events.php文件中注册,通过以数组形式添加你代码的信息。每个事件只需要知道模块、控制器、类库、helper的名字就可以。示例:View Code $config['event_name'][] = array( 'module' => 'module 阅读全文
posted @ 2013-02-04 18:49 kelite 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 模板类为系统核心类库,为能更好的组织主题,使模板更加高效。/** */class Template{ private $_module = ''; private $_controller = ''; private $_method = ''; private $_theme = NULL; private $_theme_path = NULL; //主题的路径可以在配置文件中设置 private $_layout = FALSE; // By default, dont wrap the view with anything private 阅读全文
posted @ 2013-02-04 18:44 kelite 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 位于application的config文件:autoload.php是CI的可以指定自动加载的配置文件:为了能自动加载elite的核心代码,需要以包的形式加载HMVC的MX文件,他们位于thirdpary文件夹中,和elite的位置。代码中,一些类库为常用类库,故自动加载。自动加载的类库不宜很多,只需要加载核心和经常用的类库。代码: 1 $autoload['packages'] = array( 2 realpath(APPPATH .'../elite'), // elite Core 3 APPPATH.'third_party' ... 阅读全文
posted @ 2013-02-04 18:39 kelite 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 受篝火的启发,本目录结构为:application/ archives/ cache/ config/ controllers/ core/ db/ backups/ migrations/ errors/ helpers/ hooks/ language/ libraries/ logs/ models/ modules/ third_party/ views/elite/ codeigniter/ helpers/ libraries/ mig... 阅读全文
posted @ 2013-02-04 18:33 kelite 阅读(320) 评论(0) 推荐(0) 编辑