CodeIgniter Forums
CI Oriented to Modules (Problems) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: CI Oriented to Modules (Problems) (/showthread.php?tid=64122)



CI Oriented to Modules (Problems) - thenets - 01-16-2016

Hi,

I'm trying to modify the CI to be oriented to Modules, not just a simple MVC.
Buy I have a lot of problems to do this from "application" directory. Sometimes the "core" and "hooks" files doesn't work as expected.

I found some problems:
- I can't change the path of "controllers", "models" and "views" from just a variable or constant
- I can't replace "CodeIgniter.php" file from "~/application/core"
- I don't know if I'm missing something, but I can't replace just a Class from a core file. I can just replace all core file content.


Talking just a little about my ideas:
I'm thing about create a framework, based on CI security, to work with modules. For exemple:

- If I'll develop a login system, this will be my tree of files
application/
application/modules/
application/modules/login/
application/modules/login/Controller_login.php
application/modules/login/Model_login.php
application/modules/login/View_index.php
application/modules/login/style.less
application/modules/login/Forge.php
application/modules/login/UnitTest.php

With this, I can reutilize my code just copying and pasting my "application/modules/login/" directory.



That's it. If somebody help me to understand CI core to do this modification, I thanks a lot!

See ya!


RE: CI Oriented to Modules (Problems) - johnny - 01-17-2016

I guess you're searching for is CI HMVC.


RE: CI Oriented to Modules (Problems) - thenets - 01-17-2016

(01-17-2016, 02:37 AM)johnny Wrote: I guess you're searching for is CI HMVC.

wow! Big Grin
That's really nice! I'll fork this project and add suport to LESS compilation and Coffee files from module folders.


RE: CI Oriented to Modules (Problems) - Diederik - 01-17-2016

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc

This is the one you need. It will allow you to create a modules directory next to your regular application and system directory. Each module can have its ow controllers,models, views, helper, configs etc. I love it because it keeps my code nice together and it's easy to copy a module from site A to site B etc.


RE: CI Oriented to Modules (Problems) - josepostiga - 01-18-2016

What about the built in Packages support? https://codeigniter.com/user_guide/libraries/loader.html?highlight=packages


RE: CI Oriented to Modules (Problems) - johnny - 01-23-2016

(01-17-2016, 04:42 AM)thenets Wrote:
(01-17-2016, 02:37 AM)johnny Wrote: I guess you're searching for is CI HMVC.

wow! Big Grin
That's really nice! I'll fork this project and add suport to LESS compilation and Coffee files from module folders.

Using CI HMVC since CodeIgniter version 2.
Heart  it and really works like a charm !

Just one remark... 
Take care about the compatibility between your MY_Controller and MY_Model versions over your different projects... 

Grtz,
Johnny


RE: CI Oriented to Modules (Problems) - thenets - 02-20-2016

I have added support to JS and SCSS to CI HMVC! Big Grin
Let's check at http://forum.codeigniter.com/thread-64442.html

I'm working to add more and more features to create the best way to develop a modular application!
I need feedback to keep working! Smile