Welcome Guest, Not a member yet? Register   Sign In
Modular structure Development for CI 2
#1

[eluser]Altaf Hussain[/eluser]
Hello All CI developers,
I am developer and working in php since two years. I worked in an open source shopping cart from more than one year and got full code understanding of that system. That system (prestashop) has an easy modular structure, which is reliable, easy to develop modules and amazing. I was thinking if it is possible to build such a modular structure for CI. But we will avoid to touch the CI code, i mean that we should not make changes in the CI core code, only we will be using CI libraries.

I used HMVC, but i was not comfortable with that, because it was not working the way i needed.

That system is using different predefined hooks ( you can add yours also easily ), which are called in that places where these are needed.

Now i got CI 2 code and was looking at it , and then i got an idea that it is possible to developer such a system. I already started work on it, but not sure that how soon i will be able to complete it and build a working module. The idea is as followed.

A) We will need at least three database tables as followed.

1) hook -> This table will have all predefined hooks
2) hook_module -> This table will have the modules assigned to hooks
3) module -> This table will have those modules only which are installed.

B) The Code idea will be as followed.

1) Modules Folder : There will be a modules folder in the application folder, which will have sub
folders as modules
2) Module Library: To build a module library which will be handling the modules, ie install/uninstall ,
assign a module to a hook, handle module code execution etc etc .

3) The main problem is here. As CI is using controllers, so how i will call the module code? There
may be some ways about which i dont know yet that how to do that, but i am sure that i will find
some solution for it. The module will have a complete class, some template files ( which will be
used for front end only ), and some more php code which will be running at front end to show the
separate page at front end for example a news list for news module.


All the above discussion is just an idea which i started to implement today and similarly sharing with all you today. If any one have any good idea than this, surely discuss on this thread. I will be very happy if someone participate with me.

Thanks to all of you Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB