One controller per page or many pages in one controller?

Posted by Rushino on Programmers See other posts from Programmers or by Rushino
Published on 2011-04-25T14:02:53Z Indexed on 2012/10/24 23:16 UTC
Read the original article Hit count: 143

Filed under:

I just wanted some advice regarding the MVC way of doing things. I am using codeigniter and I was wondering if it's better to have one controller per page for a website or to have one controller for all the pages?

Let's say I have a simple website where you can visit the homepage, login, create an account and contact the admin.

  1. Would it be better to have these controllers: frontend(index), login, account, contact OR having one controller called frontend or whatever with the actions such login, createAccount, contact?

  2. When do you know if its better to use one controller in a situation?

© Programmers or respective owner

Related posts about mvc