Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - HMVC version 5.3

The last one proposed it's not really modular. Subcontrollers modules cannot be ported easily to other project without "picking" each component from common models/controllers/views/libraries/etc directories. Anyway I appreciate your suggestion!

If your MY_Controller is extending the CI_Controller then you are using Modular Separation not HMVC

For true HMVC your MY_Controller needs to extend MX_Controller.

Module Structure:

-- module_name
---- config - can hold routes.php etc;
---- controllers - the controller_name should be the same as the module_name.
                            If not then you have to access using module_name/controller_name
-------- module_name - controller
-------- other_controllers
---- libraries
---- models
---- views

You should be able to have other directories but then you have to access then in order 1/2/3/controller etc;


It is matter of semantics what is really modular. If your "subcontrollers" folder is named "admin", then OK, avoid the third way. The routes.php rules might be a better choice, I have seen it within PyroCMS.

For "admin" there is the fourth way - a separate application, but that is a long story.


I have a CI project with Modular Extensions - HMVC correctly installed.

I try to have one database settings per module.

So, I have one application/modules/module/config/database.php file in order to create different values for these objects :
- $active_group & $active_record variables
- $db array

And I would like that this file overwrites the default settings defined in the application/config/database.php file.

- application
--- config
------ database.php
--- modules
------ module
--------- config
------------ database.php

This doesn't work, CI doesn't load the module/config/database.php file.

Maybe I need to change some settings in autoload file ?

Thanks to help me.

CI only loads it from application/config, you can set different configs in the database.php and then
switch them later. See the database configuration in the Users Guide.

Yeah I know that but I wanted know if there's no way to load it from module/config with HMVC.

Because as you say, if I set different configs in the database.php I should switch them later with different value for $active_group.

You seem tell me that it's impossible, so I will change the $active_group value in my constructor method of my controller.


Theme © iAndrew 2016 - Forum software by © MyBB