Top "Twig" questions

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

Is there a Twig shorthand syntax for outputting conditional text

Is there a shorter syntax in Twig to output a conditional string of text? <h1>{% if not info.…

php twig
Increment value in twig file

I have a loop withing a .twig file that outputs elements. I need to increment a value withing each element. …

twig
Accessing array values using array key from Twig

Does anyone know how (of if it's even possible!) to do this in Twig? I can't see anything in the …

php twig
Output array in Twig

I trying to output an array from the database to the screen. In my entity: /** * @ORM\Column(type="array", nullable=…

arrays symfony doctrine-orm twig longtext
Symfony2 Path to image in twig template

I store img in Acme/DemoBundle/Resources/public/img/weather_icon/blizzard.gif I want to put this img in …

symfony twig assetic
How to combine two string in twig?

I want to do something like this: {% set c=a+b %} Where a and b are strings. How can I …

twig
How to access class constants in Twig?

I have a few class constants in my entity class, e.g.: class Entity { const TYPE_PERSON = 0; const TYPE_COMPANY = 1; } …

php templates twig
Check if variable is string or array in Twig

Is it possible to check if given variable is string in Twig ? Expected solution: messages.en.yml: hello: stranger: Hello …

twig
How to insert a Controller in Twig with "render" in Symfony 2.2?

I'm upgrading my project from Symfony 2.0.22 to 2.2.0 and review somes changes, but i'm blocked on this : I would like to …

symfony twig symfony-2.2
How do you check if an object exists in the Twig templating engine in Symfony2?

I have a multidimensional array where some objects exist and others don't. I keep getting a Method "code" for object "…

symfony twig