I'm new in OOP php and started learning by checking out courses and tutorials with the mvc-model. Most is understandable. Then I started to check out how to use OOP on my website. The first thing I've wanted to change was to dynamically fill the social media tags by data that is used on multiple places of the website. I'm wondering if I'm on the right track.
So here are my thoughts:
There are three flavours, I think.
1. the homepage, example: www.mywebsite.com
2. a chapter, example: www.mywebsite.com/news
3. a content item, example: www.mywebsite.com/news/winteriscoming
create a class called PageInfoModel: here I will select the url, image en titel of the page from the database, in case of the first 2 flavours
create a class called PageInfoView: contains properties url, title, image and a get and set method for the properties
A controller is not necessary.
In case of flavour 3 the properties need to be filled by a contentitem class, I think. So no duplicate code is made.
Is this the right way to go and if so, how do I do flavour 3?