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: