Welcome Guest, Not a member yet? Register   Sign In
How do you setup your controller(s)?
#1

[eluser]sorenchr[/eluser]
Hi, I was wondering how you find it most easy to setup your controllers. Do you use one controller pr. sub-section (ie. "Friends", "Inbox", "My account" etc.), or do you just use one controller that keeps all of the sub-sections?
#2

[eluser]Christopher Blankenship[/eluser]
eek only using one controller, unless the site is small and doesn't do that much it would in my opinion be a waste of the power of CodeIgniter, not building for site growth, not to mention a troubleshooting or coding nightmare as the site does grow.
#3

[eluser]EugeneS[/eluser]
separate your controllers/models/views logically...

for example to manage articles one set of controller/model/views
to manage users another set of controller/model/views

reuse models in different controllers

by using one controller for everything you are simply loosing sense of MVC pattern, what the sense of using MVC framework in this case ?
#4

[eluser]heavenquake[/eluser]
I usually use one controller per site "section". Ie one User-controller, that has register(), login(), display(), edit(), etc. etc. methods, and so on.

I'm currently experimenting with a single-controller setup, where the logic is in widgets instead. Everything is routed to this controller, which the looks up in the database/config what widgets it should load for this particular page. It seems to be working out pretty well so far. I'll be putting some code up on github soon :0)




Theme © iAndrew 2016 - Forum software by © MyBB