Model View Controller

In chapter 8, Tom shows us how to move the functions into a Controller Class.

My question is: where are the View and Model?

Are the files in the template folder the View(s)?

Does index.php file contain the Model?

Link to content: PHP & MySQL: Novice to Ninja, 7th Edition - Section 8

Edit: This stackoverflow Understanding MVC Views in PHP showed me that I suffer from the "widespread misconception that views are simply glorified template file". Anyone recommend any books or articles about this topic?

I don’t go into MVC in detail in the book, partly because most PHP frameworks don’t use MVC (even if they use some of the terms). A lot of “MVC” php frameworks call templates views and the database access layer (our DatabaseTable class) the model. While these terms are used in a lot of PHP web frameworks (and Ruby on Rails, which started this trend), it doesn’t directly map on to the original MVC concept. A brief explanation of what happened is that the Ruby on Rails developers saw a tangentially similar separation of concerns with what we’d been doing in the web for years (Database abstraction as a model, Templates as a view and a bit of code to link them together they called the controller).

It’s less important to try to adhere to MVC or the terms than to understand the separation of concerns and where the boundaries are drawn between components than MVC itself, as it tends to muddy the waters when there is no clear definition.

Myself ( ) and others ( , ) tried to point this out years ago, back when the frameworks were becoming more popular but we’re kind of stuck now with this MVC in name only approach because that’s what everyone is used to.