Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Enhancing a Simple PHP Application Refactoring the Codebase Separating Concerns: Views

SERGIO RODRIGUEZ
SERGIO RODRIGUEZ
17,532 Points

The products.php has a function to get the list view of products. Shouldn't this be a view instead of a model concern?

By the end of the refactoring process, the products.php file has a function called get_list_view_html, which returns the html needed to display the products on a list.

Taking into account the Separation of Concerns, why is this function part of the Model Concern?

1 Answer

Shawn Flanigan
PLUS
Shawn Flanigan
Courses Plus Student 15,815 Points

Sergio,

Astute! Randy touches on that in a later video: Using Partials. He asks us to fix the problem on our own, but it sounds like it's corrected in the final project files if you want to see how he separates the concerns.