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.

Volt - Include assign vars

Is there a usual way to assign variables specially for the template using "include"?

{% include "path/to/template.volt" %}

I think if you are using {% include %} most of the time you include a partial template (let's say a variable x is included) into the main template and then $this->view->setVar("x", what you define as x ) in your main controller.



35.8k
Accepted
answer
edited Aug '15

https://docs.phalconphp.com/en/latest/reference/volt.html#view-integration

{# Passing extra variables #}
<div id="footer">{% include "partials/footer" with ['links': links] %}</div>


2.5k
edited Aug '15

Well, thank you Lajos Bencz. :)
BTW.: Sorry for the bad vote.. my mistake x)