MVC Model architecture

Posted by ATT on Stack Overflow See other posts from Stack Overflow or by ATT
Published on 2011-01-05T10:39:25Z Indexed on 2011/01/05 10:54 UTC
Read the original article Hit count: 131

Filed under:
|
|

I'm getting into CodeIgniter and trying to figure out the good architecture for my models. What kind of models would you create for the following simple example:

  • list page of blog entries: shows part of the entry data, number of comments
  • blog entry page: shows all the entry data, comment list (with part of the comment data)
  • comment page: shows all the comment data

I'm trying to get this right so that it's simple and effective. I don't want to load too much information (from the db) on the pages where I don't need them.

E.g. should the same entry model handle both multiple entries as well as a single entry? And how should the comments be loaded? I only need the number of comments on the multiple entries (list) page but some of the comment data on the single entry page. How would you handle this?

© Stack Overflow or respective owner

Related posts about php

Related posts about mvc