Top "Twig" questions

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

Symfony2 Get User Role in Twig

I have one question, How can i get User role in Symfony2 Twig. I Had looking around but I couldn't …

symfony twig user-roles
access loop.index when within another loop in twig

How can i access the loop's index when i'm in a second loop? like this: {% for i in range(0, 3) %} {% for …

twig
Symfony Error: "An exception has been thrown during the rendering of a template"

I am trying to include <link href="{{ asset('css/mystyle.css') }}" rel="stylesheet"/> in my twig file and …

php symfony twig rendering symfony4
Updating object properties in twig

Is there a way to update an object's property in twig? An object like the following is passed to twig: …

php twig
Forcing the Twig Locale

I would like to use the Twig template system to template my e-mails. The locale of the e-mail should be …

php symfony twig
filter boolean variable in a twig template

I have a boolean variable(0, 1) in my database and I want to filter it to a word 0 for 'NO', and 1 …

symfony twig
Twig extend template on condition

I use Symfony 2 with Twig and my question is pretty straightforward: In a view I want to extend one of …

php templates layout symfony twig
Symfony2 : accessing entity fields in Twig with an entity field type

Here is my FormType : public function buildForm(FormBuilder $builder, array $options) { $builder ->add('user', 'entity', array( 'class' => …

symfony twig symfony-forms
How to escape Twig delimiters in a Twig template?

Twig uses the {{ }}, {% %}, {# #} delimiters. But how can I display {{ }} in a Twig template? I'm not talking about HTML escaping. I …

twig
Check if template exists before rendering

is there a way to check if twig template exists before calling to render? A try catch block seems not …

symfony twig transclusion