Share and update variable in twig template

Viewed 10

I would like to update a variable in the twig include model.

I want to position absolute html tags.

Is there a way to do something like this?

{# Main template #}        
  {% set actualTop = 0 %}
  {{ include ("firstTemplate.html.twig") }}
  {{ include ("secondTemplate.html.twig") }}

{# firstTemplate #}     
  {% set actualTop = actualTop + 10 %}

{# secondTemplate#}        
  {% set actualTop = actualTop + 20 %}
0 Answers
Related