Using the Symfony framework, I passed two values from the background to the twig, and then I wanted to assign the value to asset (), what should I do? The code for the controller passing value is as follows:
return $this->render("AcmeMinsuBundle:Default:advsImage.html.twig", array('pagination' => $pagination,'cfgImagePath' => $cfgImagePath) );
The twig code is as follows:
{% for paginations in pagination %}
{% endfor %}
I know the above method is not, that Cfgimagepath and paginations.getadvsimagepath these two variables together is a picture of the path, I changed how to pass the value or write twig inside the code to achieve it. Just start with symfony, a lot of not very understand, forget you are generous enlighten.
Reply content:
Using the Symfony framework, I passed two values from the background to the twig, and then I wanted to assign the value to asset (), what should I do? The code for the controller passing value is as follows:
return $this->render("AcmeMinsuBundle:Default:advsImage.html.twig", array('pagination' => $pagination,'cfgImagePath' => $cfgImagePath) );
The twig code is as follows:
{% for paginations in pagination %}
{% endfor %}
I know the above method is not, that Cfgimagepath and paginations.getadvsimagepath these two variables together is a picture of the path, I changed how to pass the value or write twig inside the code to achieve it. Just start with symfony, a lot of not very understand, forget you are generous enlighten.
Short answer: You need to use the " ~ " operator (see twig documentation)
Long answer:
You need to change the picture label to the following:
Explain:
" {{ }} " cannot be nested
Concatenate two or more variables, strings, with the " ~ " operator, equivalent to the PHP " . " operator
assetis twig a function, the passed variable is for the function, instead of the output to the HTML, there should be no quotation marks