CodeIgniter Forums
Modular Extensions - HMVC version 5.3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Modular Extensions - HMVC version 5.3 (/showthread.php?tid=33523)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39


Modular Extensions - HMVC version 5.3 - El Forum - 09-13-2014

[eluser]redcloud80[/eluser]
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!


Modular Extensions - HMVC version 5.3 - El Forum - 09-13-2014

[eluser]InsiteFX[/eluser]
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:

Code:
modules
-- 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;



Modular Extensions - HMVC version 5.3 - El Forum - 09-13-2014

[eluser]ivantcholakov[/eluser]
@redcloud80

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.


Modular Extensions - HMVC version 5.3 - El Forum - 09-29-2014

[eluser]Gwynbleidd[/eluser]
Hello,



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.

Code:
- 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.


Modular Extensions - HMVC version 5.3 - El Forum - 09-29-2014

[eluser]InsiteFX[/eluser]
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.





Modular Extensions - HMVC version 5.3 - El Forum - 09-30-2014

[eluser]Gwynbleidd[/eluser]
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.

Thanks.