Welcome Guest, Not a member yet? Register   Sign In
How to design a (truly) modular application with CI?
#1

[eluser]liri[/eluser]
Hey guys,

While there's alot to it that I want to cover, I will start with the basics -
how to achieve modular design in terms of the pages.

The application will have primary Categories (example: Management, Reports) and for each
category there will be Sub-Categories (example: Management-> Users, Groups, etc).

One approach I was thinking is to make the Categories "hard coded" in terms that each will be
a CI's controller and the Sub-Categories will be the pluggable plugins/modules which will there-fore
provide a modular approach.

Questions:
1. Is that the "correct" way to implement such architecture?
2. If so, how should the pluggable sub-categories be implemented?
3. To make it truly modular, how would the categories themselves be designed for pluggable modules that can be added/removed?


Would love to hear thoughts from experienced folks,
Thanks.
#2

[eluser]liri[/eluser]
To be more clear, the architecture resembles a type of group and it's children, such as:
Management
---> Users
---> Profiles
Reports
---> Report 1
---> Report 2

So that the actual functionalities are the sub-categories (children) and the categories (groups) like Management
are just a way to group the functionalities into some organization logic.
With that said though, I would like the sub-categories to be modular so that when Management link is clicked it
"scans" and lists all the sub-categories related to it. So the sub-categories become modular, can be added and
removed.


After looking around a bit, probably the Modular Separation library is what I need, which will result in having the
Sub-Categories (the actual functionality pages) being controllers, and these can be added/removed.

If that is the case, what would Categories be? the modules themselves?
#3

[eluser]Mischievous[/eluser]
With module sepeartion, you have your modules if you specify a controller with the same name as the module name it is immediatley the default controller for that module. so any other controller will be a subset of that module

ex:

"reports" module - "reports" controller = url: /reports/
"reports" module - "report1" controller = url: /reports/report1/

hope that makes since?
#4

[eluser]liri[/eluser]
That makes sense but it's not what I'm talking about.
I can't use this method where the module name is the Category and the controller is the sub-category because - the most important thing is to make the sub-categories modular, meaning that the admin can enable/disable them, upload and add them or remove them. In your example, what will happen is that the "reports" will be the category and module name and then reports1 will be one controller and reports2 will be another controller. Assuming that's fine, it's not really modular in the sense that how should the admin remove it? I'll have to implement more functions in handling these controllers, their views, etc... it misses the entire point.
#5

[eluser]Mischievous[/eluser]
OH! gotcha... so you need a dynamic controller method? if you let me in on your scenario a little more and ill be able to help you out.
#6

[eluser]liri[/eluser]
I'm not sure how else to explain it Smile
Except that, what I'm looking for is a functionality of grouping together modules to form a collection of modules.

But here goes another try: look at the image attached
The "Intro" "About" and "Examples" are the modules and the "Management" and "Reports" are the categories or I don't know how else to call them.
If the user clicks on the "Management" page, there's no genius logic behind it, it should just load say the first module that belongs to the "Management" category.

The "dynamic" here is that upon clicking the "Management" link it should generate the module list (that's easy with iterating through the modules and maybe storing a metadata variable of what is the parent category name).

The other "dynamic" requirement here is that the categories themselves will be iterated upon so that it is possible to add/remove categories. It's also not enough for it to be some hard-coded HTML because upon clicking it's necessary to set the category as active (for css look&feelWink.


I've done some early progress with having
MY_Controller
--> Management_Section (extends MY_Controller)
--> Users (extends Management_Section)
where I iterate over the *_Section classes and load them, that's how I also generate the navigation list and store in each class an array of data, whether the category is active and such.
Then I can later in the module access this property and set it to active/disabled etc...


It's not really going as smooth as I want and I'm probably approaching this design issue the wrong way which is why I'd appreciate some advice on this (keep in mind I'm fairly new to CI).


Thanks again.




Theme © iAndrew 2016 - Forum software by © MyBB