Do It Yourself – Tutorials – MVC and how to create your first blog with Codeigniter 4 | Tutorial Part 4

by | Jul 8, 2020 | 0 comments

Do It Yourself – Tutorials – MVC and how to create your first blog with Codeigniter 4 | Tutorial Part 4

by | Jul 8, 2020 | Do It Yourself - Build Your Own Website | 0 comments

Do It Yourself – Website Tutorials



MVC pattern (Model View Controller) is one of the most confusing parts when you are starting using Codeigniter for the first time after working on simple PHP projects. That’s why at this tutorial we are going step by step learning MVC starting without even using Codeigniter just to understand some basics. On the other hand once you’ve learned it everything seems so easy and natural by using it.

At this tutorial we are focusing on examples of the MVC pattern and at the same time we are trying to have a complete blog in Codeigniter 4. It is very important also to not forget the Routes as it is the main file that is communicating with our Controller directly!

Timestamps:
0:00 Intro – What is MVC?
0:42 Simple PHP example (without Codeigniter)
4:14 Routes and Controllers in Codeigniter
9:23 Models in Codeigniter
12:10 Views in Codeigniter
15:00 Tidying up and complete our blog
17:14 Outro – Thank you! 🙏

Code for the tutorial: https://github.com/scoumbourdis/codeigniter-4-tutorials-mvc
Template used: https://startbootstrap.com/themes/clean-blog/
MVC image (from wikipedia): https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
Messy PHP code: https://gist.github.com/scoumbourdis/6300ddbfc347b4e9e4b975d751d9d4c0
Progress bar animation: https://codepen.io/web-johnny/pen/OJVdydZ
Codeigniter 4 Routing: https://codeigniter4.github.io/userguide/incoming/routing.html

source