When is a view not just for presenting data?

Hey, I know that in a MVC type design, your view should contain all presentation of data to the user.

I have some conflicts with this. I want to be able to show my user something depending on some data. So I would have to query the database and check for a piece of info and then show the user something depending on that info.

Does this break MVC conventions or am I ok doing it this way? Other method suggestions welcome.


I want to mark a blog post if the user has commented on it.

The right way: get all the data in controller (including that post have user’s comment) and pass it to your view. In view you can use simple check like



Just one comment here:

  • It is also widely encouraged to keep your Controller as skinny as possible and put large portion of the logic in the Model itself.

See here: http://www.youtube.com/watch?v=91C7ax0UAAc