Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 1
    Great answer, thank you. Extending your 'looking ahead' scenario slightly; if there is common information on a page that is separate to what is requested (e.g. user is viewing a specific product, a general list of 'latest special offers' are shown at the side) how/where should the call to the offers_model->get_latest() be made? Adding this into every method in the controller (as I've foolishly attempted before) seems like overkill and distinctly un-DRY. Commented Jan 31, 2013 at 19:02
  • 2
    @AdamWestbrook Take a look at MVVM. The ViewModel part of that can address this specific problem. You can add the offers_model->get_latest() to a ProductViewModel base class or something similar. Commented Jan 31, 2013 at 19:05
  • 1
    Great, I'll definitely look into MVVM, thanks again. Commented Jan 31, 2013 at 19:14
  • Very good answer, will defiantly keep this starred. Personally I'm also a big fan of MVVM :) Commented Jan 31, 2013 at 21:44
  • @BenjaminGruenbaum Are you using MVVM in PHP? If so are you using a particular framework for it? Commented Feb 1, 2013 at 10:42