How to divide logic and representation (on the fingers), the PLO?

All kind time of day!
I apologize in advance for surround and perhaps curve issue.
Please explain "on fingers" how to separate the logic in the project. I would be very grateful for useful information and links on bikes for educational purposes. Frameworks are not interested, because I want to understand myself.
Later can add an example of your code. Perhaps someone can give an example of how I should act in a particular moment.
The backend started to do recently. And in this respect move method "Learn only what is necessary for the realization of tasks". Yes, definitely, every new project turns out better than before.
As the projects are small, relatively, I didn't worry about how and where to implement the logic. But, I understand that, most likely, this is not true, when I have logic to invalidate the cache was in the same file, in which nahoditsya the information to render the page.
June 5th 19 at 21:32
2 answers
June 5th 19 at 21:34
Solution from the material in the folder structures of the PLO. Files visible all logic.

P. S. Why write on the fingers of something that is already written by someone?
June 5th 19 at 21:36
Apply the MVC pattern.
1. To the server the request arrives.
2. Routing determines which controller to call.
3. The controller accesses the model to retrieve data (from a database for example)
4. The controller calls the view (template) and sends it the data to display.

Here is my bike, a bit old already though:
well, what is actually displayed?\ - vito_Fries commented on June 5th 19 at 21:39

Find more questions by tags PHP