N
N
navodchik1312019-07-05 07:35:15
Twig
navodchik131, 2019-07-05 07:35:15

Shared variable in twig templates?

Good afternoon everyone. I have a twig template, two more templates are included in it via include.
Is it possible to work and change with one variable in all 3 templates?
those. in the main, I create a variable, pass it to the first template, something is done with it, returned to the main one, from there it goes to the second template (with the value that turned out after the first include), processed again and the result is displayed on the main template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kafkiansky, 2019-07-05
@navodchik131

That is, you will have a cyclic dependency of templates? It doesn't work like that. Twig allows you to define global variables if needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question