Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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 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 %}        

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

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 ;]