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

how can i send parameters from one volt file to another

i am including a volt file in another volt file, now how can i send parameters from one file to another...here i want to send request parameter to search.volt file.......HOW?

    <section class="">
    {% include "searchengine/search.volt" %}
    {% if query %}
        {% set request=query %}
    {% else %}
        {% set request=null %}
    {% endif %}        

</section>
edited Feb '17
<section class="">
    {% include "searchengine/search" with ['request':query] %}
</section>

https://docs.phalcon.io/en/3.0.0/reference/volt.html#view-integration

edited Jan '17

Yes, you will have the queryvariable passed in to search.volt which you can reference by request.

The with keyword allows you to define multiple variables, as well as a unique name for each (the array key).

edited Jan '17

Thank you.!! But there is a small correction,when we include the volt file with parameters we should remove the extension of the file

    {% include "searchengine/search" with ['request':request] %}

thx, edited for future reference ;]