We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multiple Views

hi guys how can I call multiple views in a controller method?

For example we have a header, body, footer view



404

You can integrate another view into your volt template https://docs.phalcon.io/en/latest/reference/volt.html#view-integration For header and footer it's better to include them in views/index.volt, as they are common for all pages. For example (index.volt):

{{ partial('shared/header') }} {{ content() }} {{ partial('shared/footer') }}



10.8k

Thank you Andrey

where to put content

please help me to get a link for a dunamic website creation



51.1k

You can use blocks. In your index.volt :

<html>
    <body>
        {% block page_header %}{% endblock %}
        {% block page_body %}{% endblock %}
        {% block page_footer %}{% endblock %}
    </body>
</html>

Then, in edit.volt for example:

{% extends 'index.volt' %}

{% block page_header %}
    Page header
{% endblock %}

{% block page_body %}
    Page content
{% endblock %}

{% block page_footer %}
    Page footer
{% endblock %}