• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MVC - Controller Questions

#5
[eluser]Colin Williams[/eluser]
You can diminish the Controller's role all you like if it serves your desired design. I think there are two ways to structure controllers: By object, by action. I think most people have object-based controllers, but action-based controllers can serve well, too, so long as you don't mind objects being handled in multiple files. If you think of something like Wordpress, all it's controller really does for the front-end is decide which view to load. It is then the views that are tasked with figuring out what to show by communicating with the models. I don't think this is a bad way to design the "designable" public-facing/front-end of your application. If you were going to write a blogging or CMS in CI, this might be an approach you take. Inventory management, project management, financial management apps, etc., might benefit from a slightly different approach since there's probably more business logic happening for all requests.

You are certainly right that for any large-sized application, you can't be cramming repeated code into each Controller you write. The challenge is how to pull these global actions out of controllers. There are various ways to do this, and CI is properly designed to do this (with libraries, extending the Controller class, or hooks).


Messages In This Thread
MVC - Controller Questions - by El Forum - 09-27-2008, 08:40 PM
MVC - Controller Questions - by El Forum - 09-27-2008, 09:11 PM
MVC - Controller Questions - by El Forum - 09-27-2008, 11:59 PM
MVC - Controller Questions - by El Forum - 10-03-2008, 04:22 PM
MVC - Controller Questions - by El Forum - 10-03-2008, 04:44 PM
MVC - Controller Questions - by El Forum - 10-04-2008, 01:47 PM
MVC - Controller Questions - by El Forum - 10-04-2008, 04:22 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.