Answers for "twig variable concatenation"

PHP
2

twig concat string

{{ 'http://' ~ app.request.host }}

// To add a filter - like 'trans' - in the same tag use
{{ ('http://' ~ app.request.host) | trans }}

// You can also use string interpolation, this does require double quoted strings:
{{ "http://#{app.request.host}" }}
Posted by: Guest on July-08-2021

Browse Popular Code Answers by Language