Codeigniter HMVC modules structure - php

I'm working on a content management system in Codeigniter with the Datamapper and HMVC extension. My question is, how to handle submodules.
Example:
I want to create an User module which exists from Users, Usergroups, Rights and Modules. In codeigniter I have build it now like this:
Codeigniter root
application
modules
Users
models
user
right
usergroup
module
Is this the right way to fix it or am I doing it wrong?

You can't have submodules in HMVC without extending the MY_router class.
You have a nice tutorial here: HMVC: an Introduction and Application

Related

Codeigniter folder structure for responsive website using hmvc extension

I am creating responsive website using CodeIgniter with following roles
doctor
hospital
guest
Each role has admin dashboard.
The website has 3 versions.
desktop version
mobile versioin
tab version
I have decided to use the HMVC modular framework to group the modules in the project.
Can anybody suggest me the suitable folder structure to my requirement.
Thanks in advance,
Santosh
#santosh,
You can use the HMVC folder structure for this problem
here you have to make a module for each
like if you want to make doctor module then make all the files and folders under doctor module
Doctor
-Controllers
-controller_file.php
-Models
-model_file.php
-View
-view_file.php
and put them in your module folder.
And you can also use Bonfire version for the HMVC codeigniter.
please visit cibonfire.com
this is the best for HMVC codeigniter

Module Separation

I'm trying to figure out how I can work with module separation with codeigniter.
Lets say I have a news module where its inside of the application folder and inside the news module folder I have a controllers, models, views folders and files inside of those.
Do I need something additional to do this?
If you want to work with modules in codeigniter you can use Modular Extensions - HMVC which makes codeigniter modular. Here is the link https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
I hope this helps.

codeigniter HMVC extension model organization

I am developing a portal and using codeigniter with HMVC extension. I have an "admin" module and a "yellowpages" module. Both these modules have a common model eg: "Category_model", and I use it to list down the categories both in the frontend(yellowpages) and backend(admin) module.
So my question is, can I place the model in the application/models directory and have it accessed by both the modules, or do I have to copy the model and place each copy inside /modules/admin/models and /modules/yellowpages/models
Resources may be cross loaded between
modules. ie:
$this->load->model(‘module/model’);
More info here and here

Kohana 3 How to render module inside application

How to integrate module inside application? I have modules having two controllers and two respective views inside module. Now I want to integrate this module inside my application, so that views and actions can be handled by this module only.
Note that your Application, modules and System files may intersect. Use this picture to understand Kohana cascading filesystem:
So, if both application and your module have a views/welcome.php, application one will be found. When two modules have files with the same path, Kohana will select module with highest position in Kohana::modules() list.
Once you have created the module enable it in the application bootstrap.php then you should be able to visit [your-website]/modualController/action you might need to look at routes.
This is a great resource for modules and routing, and everything else Kohana http://kerkness.ca/wiki/doku.php

Sharing controllers, models and views between separate projects in CodeIgniter

Kohana, due to cascading file system and modules, allows to share code in common projects, that contains controllers, views and models directories. How can I do it in codeigniter? I want to create sites, that will share some code (admin area views, some models). That is easy in Kohana, we just have to add another directory for Kohana::find_file().
I think this is a duplication of:
Codeigniter Shared Resources - Opinions Wanted
And
How do I load a view from a specific (shared) path in CodeIgniter?
I'm more experienced in Kohana than CI but if I'm right there is a HMVC module in CodeIgniter. You could see if you are able to request a external page like you can with the HMVC of kohana.
If I may ask. why do you use codeigniter when you know kohana does the job better?

Categories