set
ΒΆ
The Twital instruction for Twig set
tag is the t:set
attribute.
You can use set
to assign variables. The syntax to use the set
attribute is:
<p t:set=" name = 'tommy' ">Hello {{ name }}</p>
<p t:set=" foo = {'foo': 'bar'} ">Hello {{ foo.bas }}</p>
<p t:set=" name = 'tommy', surname='math' ">
Hello {{ name }} {{ surname }}
</p>
Note
For more information about the set
tag, please refer to
Twig official documentation.