Top "Twig" questions

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

Accessing the logged-in user in a template

I'm using FOSuserbundle to get started with User registration https://github.com/FriendsOfSymfony/FOSUserBundle I've got it registering / logging in …

symfony twig fosuserbundle
How to use absolute path in twig functions

I have an application with Symfony2 (2.2). When I want to send a mail, I'm having trouble with the paths, which …

symfony routing twig
How can I use break or continue within for loop in Twig template?

I try to use a simple loop, in my real code this loop is more complex, and I need to …

php symfony for-loop twig break
Counting the number of elements in array

I am looking to count the number of entries I have in an array in Twig. This is the code …

twig
Directly access a form field's value when overriding widget in a twig template

What I want to do is get variables stored in form view. {% form_theme edit_form _self %} {% block field_widget %} {% …

symfony twig
In Twig, check if a specific key of an array exists

In PHP we can check if a key exists in an array by using the function array_key_exists(). In …

php arrays twig conditional short-circuiting
str_replace in Twig

I want to do a simple str_replace in my twig template. I'm new to twig and probably I need …

php filter str-replace twig
Symfony 2: How do I check if a user is not logged in inside a template?

In Symfony 2 templates (using Twig), how can I effectively check whether a user is not logged in? I don't want …

symfony authentication twig symfony-2.1
AngularJS-Twig conflict with double curly braces

As you know, both angular and twig has common control construction - double curly braces. How can I change default …

angularjs twig
How do string comparison operators work in Twig?

How is this possible? It seems to be a very very odd issue (unless I’m missing something very simple): …

php twig