How to Properly Make use of Codeigniter's HMVC
Posted
by
Branden Stilgar Sueper
on Programmers
See other posts from Programmers
or by Branden Stilgar Sueper
Published on 2012-08-27T20:57:13Z
Indexed on
2012/08/27
21:55 UTC
Read the original article
Hit count: 338
I have been having problems wrapping my brain around how to properly utilize the modular extension for Codeigniter. From what I understand, modules should be entirely independent of one another so I can work on one module and not have to worry about what module my teammate is working on. I am building a frontend and a backend to my site, and am having confusion about how I should structure my applications.
The first part of my question is should I use the app root controllers to run modules, or should users go directly to the modules by urls? IE: in my welcome.php
public function index()
{
$this->data['blog'] = Modules::run( 'blog' );
$this->data['main'] = Modules::run( 'random_image' );
$this->load->view('v_template', $this->data);
}
public function calendar()
{
$this->data['blog'] = Modules::run( 'blog' );
$this->data['main'] = Modules::run( 'calendar' );
$this->load->view('v_template', $this->data);
}
My second part of the question is should I create separate front/back end module folders
-config
-controllers
welcome.php
-admin
admin.php
-core
-helpers
-hooks
-language
-libraries
-models
-modules-back
-dashboard
-logged_in
-login
-register
-upload_images
-delete_images
-modules-front
-blog
-calendar
-random_image
-search
-views
v_template.php
-admin
av_template.php
Any help would be greatly appreciated.
© Programmers or respective owner