Top "Twig" questions

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

Symfony2 security functions in Twig? How to check the user's role?

I have Symfony 2.0.9 standard edition installed with JMSSecurityBundle. Just wondering what functions are available to me in a Twig template …

symfony twig
Adding JS and CSS cleanly from included Twig templates

I'm looking to find out if there's a clean way to add JS and CSS from included templates. So, for …

symfony twig assetic
How reload Twig cache in Symfony 2

I have a application which is developed in PHP using the Symfony 2 framework. I have changed a HTML file, but …

php symfony twig
Twig, add first and last class

Let's say I have a for loop like this: {% for elem in arrMenu %} <div class="topmenu-button"> <a …

php symfony twig
Twig Access Array Index?

Is it possible to directly access an array index from within a Twig template? Here's my setup, using Silex: return $…

twig silex
TWIG how to get the first item from the array

I need to get the first item from the field in the twig template. Is there some kind of function?

arrays twig
Get the environment name in a Twig template with Symfony2

Is there a way to get the name of the current environment in a Twig template? I'd like to set …

symfony twig
Is it possible to access Route parameter in twig template directly?

A view element on my page depends on a route parameter and will render something if a route parameter is …

symfony twig
Generating routes in javascript with Twig and Symfony2

Quite odd problem, sorry for asking, i'm quite new to Symfony/Twig. My route requires a mandatory region_id paramenter: …

javascript symfony routes twig
add active class to link with sf2 and twig

following simple code: <li><a href="{{ path('_list') }}">List</a></li> …

php url symfony twig