[NFR] Volt support "with"
Add possibility additional variables by passing them after the "with" keyword:
{# the foo template will have access to the variables from the current context and the foo one #}
{% include 'foo' with ['foo': 'bar'] %}
{% set vars = ['foo': 'bar'] %}
{% include 'foo' with vars %}
Add possibility disable access to the context by appending the only keyword:
{# only the foo variable will be accessible #}
{% include 'foo' with ['foo': 'bar'] only %}
{# no variable will be accessible #}
{% include 'foo' only %}
I am not sure I understand this - i.e. the value of it. What do we need to achieve that with will help with?
It will help develop universal partials and restrict namespace by anologii http://twig.sensiolabs.org/doc/tags/include.html
The 'include' statement in Volt has a different behavior, it includes the requested view in the view where the 'include' was made. This reduces the number of read files increasing performance. In summary, a 'include' joins every included file into the parent one.
We could implement this in the partial function which is in fact dynamical.
http://docs.phalconphp.com/en/latest/reference/volt.html#partial-vs-include
This is implemented in 1.2.0, thanks