Welcome Guest, Not a member yet? Register   Sign In
best controller architecture
#1

[eluser]spherop[/eluser]
I am new to CI and to some degree the MVC approach.

I want to try to understand something before i get too tangled in one approach or another.

I am using CI and jQuery for a new site in which most all of the functionality will be within a single page. Different data and UI behavior will occupy different parts of the screen, be loaded dynamically, and be able to be shown and hidden and so forth.

What I am unsure of is whether to use a single controller - to govern this single page. Or to use a different controller for each part of the page that deals with different data/behavior.

Say for example, I have a comments pane on the left, a video blog in the middle pane, and a friends view in the right pane. Would I most likely end up with a distinct controller for each of these 3? Or 1 controller that will handle this whole page?

I am getting my bearings here - so forgive me if this is obvious or I am missing some key concepts in the line of questioning.
#2

[eluser]wiredesignz[/eluser]
Standard CI allows only a single controller per request, so your answer is there.

However once you get comfortable with CI you may like to look at Modular Extensions. (see my signature)

ME is designed to allow you to compose pages from view partials, with each part having a seperate controller as you describe.

Good Luck.
#3

[eluser]frith[/eluser]
his page is made up of isolated ajax requests. He could very easily have each of those point to a different controller. No CI limitations there.

I would examine the content of the page in question. If it's focused on a single object or inherintly related to one object then I would group that functionality into a single controller. For instance a video controller with action post_comment()
#4

[eluser]wiredesignz[/eluser]
There still must be a single controller creating the page! Unless you suggest multiple javascript callbacks to create the page initially :lol:

Modular Extensions is perfect for Ajax callbacks, each module controller is accessible from the URL.
#5

[eluser]spherop[/eluser]
thank you both ... i am very interested in Modular Extensions and what it provides. I will check it out once I am solid with CI - though seems to be very straightforward so far (well-designed).

frith- good point and i may utilize this in the interim. as wireddesignz says - the initial page would love via one controller - however other controllers could be subsequently called to handle inline behaviors.

in the long run though - the ME concept of full modularity is very appealing. I'd like to strive for great re-usability.

thanks again.




Theme © iAndrew 2016 - Forum software by © MyBB