Top "Twig" questions

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

Check if string variable is null or empty, or full of white spaces

How can I check if a string variable is null or empty, or full with space characters in Twig? (Shortest …

string twig isnullorempty
Id attribute on form tag symfony

I would like to define a id attribute on my symfony2 forms. I've tried with this in my twig template: {{ …

symfony twig
Formatting money in twig templates

Are there any filters or something like that in twig template engine to format money or numbers?

numbers format currency twig
Testing variable equality in twig

In twig, is there an easy way to test the equality of 2 variables? {% if var1 = var2 %} isn't valid, {% if var1 …

php templates twig
Simple check if form field has errors in Twig template

In Twig template I check if a field has an error like this: {% if form.points.get('errors') is not …

symfony twig symfony-forms
Twig Symfony2 get Request variable

I know I can do this: app.request.get('name') ...but how do I do this? app.request.get(twig_…

symfony twig
Use Javascript to access a variable passed through Twig

I have a controller that passes an array to a twig template, which I want to use in a script …

php javascript symfony twig
Symfony 2 - Working with assets

I need some tips on how to work with assets in Symfony 2. For example, do we have to always perform …

symfony twig assetic
How to handle Translation in twig file using variables?

I have a twig file and a yml, in which I define the variables for translation e.g.: YML File …

symfony translation twig code-translation bundles
In TWIG, is possible to get absolute url of a link with twig variables in it?

I have several URLs that look as follows: {{domainID}}/action/{{userId}}/anotherAction And the latter URL points to: http://localhost/…

symfony twig