Top "Twig" questions

Twig is a modern, fast, flexible, and secure templating engine for PHP.

How to concatenate strings in twig

Anyone knows how to concatenate strings in twig? I want to do something like: {{ concat('http://', app.request.host) }}

syntax twig string-concatenation templating
get current url in twig template?

I looked around for the code to get the current path in a Twig template (and not the full URL), …

symfony twig
Twig: in_array or similar possible within if statement?

I am using Twig as templating engine and I am really loving it. However, now I have run in a …

twig
How to check for null in Twig?

What construct should I use to check whether a value is NULL in a Twig template?

php twig short-circuiting
Twig for loop for arrays with keys

I use Twig and I have an array with keys like this: array[1] = "alpha" array[2] = "bravo" array[3] = "charlie" array[8] = "delta" …

php arrays loops twig
How to render a DateTime object in a Twig template

One of my fields in one of my entities is a "datetime" variable. How can I convert this field into …

php symfony datetime twig
twig: IF with multiple conditions

It seem I have problem with a twig if statement. {%if fields | length > 0 || trans_fields | length > 0 -%} The …

php twig conditional-operator
How to var_dump variables in twig templates?

View layer pattern where you only present what you have been given is fine and all, but how do you …

debugging twig
IF a == true OR b == true statement

I can't find a way to have TWIG interpret the following conditional statement: {% if a == true or b == true %} do …

twig
How to get config parameters in Symfony2 Twig Templates

I have a Symfony2 Twig template. I want to output the value of a config parameter in this twig template (…

symfony configuration twig