A
A
alex14422015-11-30 17:06:23
symfony
alex1442, 2015-11-30 17:06:23

Twig how to use variable variable(same as in php $$var)?

Hello,
there is an output of a link to an image depending on the format:
{{post.images . {format} . url}}
how to set format as a variable?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BoShurik, 2015-11-30
@alex1442

twig.sensiolabs.org/doc/functions/attribute.html

S
skyfortress, 2015-11-30
@skyfortress

The approach itself is not very correct. I think that it is better to write a getter with the necessary logic in the model, although here you need to look in more detail.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question