Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Designing/Implementing MVC from Scratch [duplicate]

I want to create my very first web app using HTML, MySQL, PHP and the Model View Controller. It will be very simple for starters: a couple of pages that allows users to input/delete data to/from the database and display the contents of the database.

However I am new to MVC, and I really wish I could have found MVC tutorials appropriate for beginners like myself on how to actually implement it using simple code examples. I only found advanced examples which makes the learning curve unnecessarily steeper. I guess I will have to create one here.

My questions are, how do I get started with designing this MVC from scratch for a very very simple web app? How do I separate the Model, the View and the Controller in code? What steps should I take and how? How do I implement the model as business entity classes, the view as HTML, and the controller as scripts that glue everything together? (assuming my understanding of this is correct) Can anyone recommend clear and straight forward tutorials on how to actually implement MVC for beginners like myself? (I could not find any).

Thanks in advance.

like image 268
Anthony Avatar asked Jul 02 '26 11:07

Anthony


2 Answers

There are plenty of frameworks to help you with this. I would recommend using CakePHP, http://www.cakephp.org. It has good documentation, a large community and a lot of tutorials!

like image 197
dale Avatar answered Jul 05 '26 01:07

dale


When you want to do MVC the first time, you do not start from scratch. CakePHP is a really good recommendation by Dale to start with. When you have done it many times and understand what MVC is about, then you will be able to implement an MVC without a framework.

like image 39
sibidiba Avatar answered Jul 05 '26 01:07

sibidiba