How to generate next page?

what's the best practice to create a page for example as shown
648ba7deb6644e44a34d7cc72f8bb77f.png
with the middle, everything is clear - the controller prepares the data and calls Ptushko, a view included layout which in its turn should in addition render
the header includes a menu structure which comes from the database, the content of the footer as well.
in the sidebar is usually one or multiple independent widgets

I remember 6 years ago I had controllers which peredali in vushku this whole thing
return [
"page_content" => $page_content,
"footer" => $footer,
"left_sidebar" => $left_sidebar,
"right_sidebar" => $right_sidebar
]

now in my layout

{{ render(controller('header')) }}
{{ render(controller('sidebar')) }}

{% block content %}
{% endblock %}

ie first works main controller and renders a view which included layout, which causes ocerall some more controllers ...
also sometimes in the layout pulling data via Twigg-extension station, for example for footer

but I do not really like

what practices are there for this?

if in addition to the main content is optional, for example, comments related to the main content, for someone to put this logic?

and what to do if the entire page is a set of small blocks-widgets. type so
5847808d71e846faa86bdb58d662a7a1.png
July 8th 19 at 11:21

Find more questions by tags Web Development