I'm using PHP Codeigniter atm. I've read a couple posts that stresses the "Fat Model and Thin Controller" and that the model is supposed to handle all the business logic, have the methods that deal directly with database and controllers deal directly with user input. Following these rules, it seems necessary to pass the $_POST array data indirectly to model through controller. But sometimes it's much more straight forward and almost necessary to deal with the user data directly in the controller

Also CI's form_validation class doesn't let you set custom error messages in the form_validation.php in the config file. To do that we need to write call_back methods. But if we gonna write call_back methods for each field, the controller is going to get 'fat' and also why would I use the form_validation class in the first place.

Another thing is that often at times I find the need to generate content according to the database and user input and etc. But doing so in the controller seems to go against the "separation of logic and presentation". For example, CI has a form and table helper, pagination, etc... These are all presentation stuff. And writing these in the controller will make controllers fat again. So I guess I should maybe write controller methods for view generation or should I write a model or library to deal with presentation?

I'd appreciate some good advice and hints on the general MVC approach. Thank you.

Related posts

Recent Viewed