I have two twig template : full_view.html.twig has this
{% set price2 = opttov.smoptprice|split('.') %}
...
{{ price2.0|default('E') }}
{{ price2.1|default('00') }}
i want to include the full_view.html.twig file in sale.html.twig and change the value of price2, to something like price2 = opttov.price|split('.').
i wrote in sale.html.twig this in for loop
{% for tov in item.tovar %}
{% include 'DevFarmUGDvorBundle:Catalog:_full_view.html.twig' with {'opttov':tov, 'opttov.smoptprice': tov.price} %}
{% endfor %}
doesnt work
You can construct the parameter for the include in this manner:
{% for tov in item.tovar %}
{%
set opttov = {'smoptprice' : tov.price }
%}
{% include 'DevFarmUGDvorBundle:Catalog:_full_view.html.twig'
with
{'opttov':opttov }
%}
{% endfor %}
Hope this help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With