Controller / View Relationship |
04-29-2017, 03:29 AM
(This post was last modified: 04-29-2017, 03:59 AM by PaulD. Edit Reason: tidied it up a bit )
I would avoid though the big fat controller if I were you.
For instance suppose your page has the following options and content: Code: Manager Home page With the page content for manager home page something like Code: Graphs I would have the following controllers Code: manager (folder) And view structure Code: manager (folder) So now, when you need to change the categories page in the manager, you would just be dealing with the categories.php controller, the categories models and libraries, and the page views in the manager/categories folder. I also (these days) try to keep my controllers as thin as possible so the manager_home.php would look something like: PHP Code: <?php Now all the work and logic is being done in your libraries. Your libraries call models to query the database to get the data, so your libraries can be slim too. You can unit test your libraries quite easily. Not saying this is the only or best way but is what I would do and it does keep everything very easy to maintain whilst avoiding big fat controllers. So not 1 to 1, nor 1 to many, but 1 to 'some' related methods. So I would have edit_user and add_user in the users.php controller, but keep them very, very thin and do all the actual work in libraries and models. |
Messages In This Thread |
Controller / View Relationship - by simon - 04-28-2017, 03:59 AM
RE: Controller / View Relationship - by donpwinston - 04-28-2017, 04:58 AM
RE: Controller / View Relationship - by simon - 04-28-2017, 01:55 PM
RE: Controller / View Relationship - by InsiteFX - 04-28-2017, 07:56 AM
RE: Controller / View Relationship - by simon - 04-28-2017, 02:08 PM
RE: Controller / View Relationship - by PaulD - 04-29-2017, 03:29 AM
RE: Controller / View Relationship - by InsiteFX - 04-29-2017, 04:28 AM
RE: Controller / View Relationship - by simon - 04-29-2017, 02:19 PM
RE: Controller / View Relationship - by lillian - 05-11-2017, 01:25 AM
|