From the course: PHP: Design Patterns

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Apply the model-view-controller pattern

Challenge: Apply the model-view-controller pattern - PHP Tutorial

From the course: PHP: Design Patterns

Start my 1-month free trial

Challenge: Apply the model-view-controller pattern

- This is probably one of the most complicated challenges in this course. We'll start with a simple three-page application that doesn't do much. From the index.php file you can click to either hello or goodbye and the corresponding php file is loaded. You can see hello and goodbye here. This means we have to make every single file publicly addressable in our app. Not a good thing. Even worse, if you click on the Unrecognized link here, we end up with a 404 File not found. We're likely to hit this error if someone changes a file name and doesn't remember to update all the links. Overall, it's a pain. I expect this challenge to take you a while. You need to break out the controller logic, come up with some simple model, and lay out some templates. Individually, it's not too complicated but, when you have to do all three at once, it can get complicated. I've added some url patterns in index.php to point you in the right direction. Once you have a solution, or want to see my particular…

Contents