Welcome Guest, Not a member yet? Register   Sign In
I need good design ideas for my controllers?
#1

[eluser]Gabriel Labrecque[/eluser]
Hello,

I've been developing a project for 3 months with CI and I enjoyed most of it so far. I'm generally happy of my design although my folder 'controllers' is getting crowded.

Some of my controller files have more than a thousand lines and I don't really want to break them into in two classes because they do share some logic.

So far, what I did is add private controller functions using the underscore prefix but they remain in the same file.

Also, some of my controllers accept form POSTs, others parse the segments of the URL. Some return views, some return jSON, some return plain/text and some return templates.

I am now considering extending the CI core Controller library to have a subclasses like Json_controller, Template_controller, etc. but before I go further and spend some time refactoring everything, I'd really like some feedback about those ideas.

Has anybody out there found a smart way of...

A) ...splitting a controller file into several? (preferably without splitting it in several controllers and manually adding items to $route[])

B) ...having Controller subclasses depending on the type of information we want the controllers to accept or return?


Messages In This Thread
I need good design ideas for my controllers? - by El Forum - 04-20-2010, 09:57 AM
I need good design ideas for my controllers? - by El Forum - 04-20-2010, 10:32 AM
I need good design ideas for my controllers? - by El Forum - 04-20-2010, 11:08 AM
I need good design ideas for my controllers? - by El Forum - 04-20-2010, 11:28 AM
I need good design ideas for my controllers? - by El Forum - 04-22-2010, 09:03 AM
I need good design ideas for my controllers? - by El Forum - 04-22-2010, 09:45 AM
I need good design ideas for my controllers? - by El Forum - 04-22-2010, 10:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB