Jump to content
Larry Ullman's Book Forums

Example 2 - Mvc


Recommended Posts

Hi,

 

I just have a couple of questions regarding the MVC patterns in example 2. I understand the view files and that they are plain HTML what the end user sees basically, but what files are considered the Models and Controllers.

 

Also moving away from the example 2 method if I was to use OOP methods what would make up the Models and controllers, for example would models be the classes and controllers be the methods used to pass the database information from model to view. Then also would it affect performance since files would need to be loaded from different parts ?

 

I am fairly new to the MVC methods within PHP.

 

Kind Regards

 

PHP 5

MySQL 5

Windows XP

IE 8/ Firefox

Link to comment
Share on other sites

To be clear, it's not a full MVC approach, it's a partial one. The PHP scripts are the controllers, the HTML scripts are the Views, and the stored procedures are, in theory, the Models. The stored procedures as Models is actually the point where it doesn't really adhere to tight MVC patterns.

 

If you were to do an OOP implementation of MVC, you'd write the Models and Controllers as classes, separate classes. An instance of the Controller class would create an instance of the Model class as needed.

Link to comment
Share on other sites

 Share

×
×
  • Create New...