Twig loop. control class names

Twig
Im trying in Twig to set different classes depending on how may items that gets rendered. Eg, if only one, if only two, if only three etc I want to se...
7 months ago

Display input field based on item selected in list

Twig
I'm using Symfony to make a website for a tennis club, and I'm beating my head down about something : I want to display an input field based on the o...
7 months ago

How to add variables to custom Twig's TokenParser?

Twig
I want to make custom twig tag, similar to include tag, but take variables from json file. I.e. in twig template I write {% section "header" %}, and i...
6 months ago

Twig - loop default value

Twig
I am trying to print array from the cotroller into the twig temlate. I want to print "-" whenever array is NULL. My problem is that in for-loop case i...
5 months ago

How to write twig tags inside TinyMCE

Twig
I have an issue with TinyMce combined with Twig, I'am trying to paste html with twig tags into tinyMce. (using raw html) here is what i want as a res...
5 months ago

symfony2 - twig - how to render a twig template from inside a twig template

Twig
I have a xxx.html.twig file which shows a page, but when I want to refresh the page with different data and just update it with new data, I have a sel...
5 months ago

how do i use timezone in Twig date filter?

Twig
I am using Twig and this date filter http://www.twig-project.org/doc/templates.html#date Apparently they are looking out for DateTime instances in t...
5 months ago

Symfony Assetic function using with variable

Twig
<img src="{{ asset("assets/img/sample.jpg") }}"/> i want to using sample.jpg with filter {% image "assets/img/sample.jpg" filter="jpegoptim" ...
5 months ago

twig view checkbox value

Twig
I want to view a checkbox in a form. But it is displayed N/A for 0 and 1 for 1 . How do I format the checkbox value to No for 0 and Yes for 1? //tw...
5 months ago

twig variable does not work inline style background-url

Twig
I have a variable passed as: {% include "Core/Layout/Templates/MYTEMPLATE.html.twig" with {'IMAGE': (positions.why|first).html|striptags } %} whe...
5 months ago

ReactJS - Unexpected "`"

Twig
I want to use this react grid: http://codepen.io/anon/pen/yOEbyw in my php/symfony frontend. I've included the JS files from that codepen but I'm g...
5 months ago

Symfony: Redirect to user profile after login with id

Twig
In my application I wish to redirect users to profile after login, so I'm using an hidden input with name _target_path and value /profile/{userid} in ...
6 months ago

How to remove all after specific character in Twig?

Twig
I'm using twig and Codeigniter and i'm trying to create links for a menu. The link's names looks like this : about_us, home, our_products_and_ac...
6 months ago

SonataFormatterBundle twig extension: Template "..." is not defined

Twig
My twig template file {{ 'Hello *world*' | format_text('markdown') }} Error: Template "<p>Hello <em>world</em></p>" is not...
5 months ago

How can i pass parameters to a Symfony2 Twig block?

Twig
I want to generate table headers in a twig block and reuse them across the page, this page has about 5 different tables with roughly the same headers....
7 months ago

Passing variable data between blocks in twig

Twig
Twig: {% set var = 'apple' %} {% block A %} {{ var }} {# This prints apple #} {% endblock %} {% block B %} {% set var = 'banana' %} {{ ...
7 months ago

What is the correct way to add bootstrap to a symfony app?

Twig
I'm using symfony framework 3 to develop a web application. I need to add boostrap's functionality to my application. I installed bootstrap using the ...
7 months ago

Looping to get all the week's days

Twig
I'm trying to get all the days of the week with a for loop in my twig view. Here's the thing I want to do : <table> <thead>...
7 months ago

Validation of a form - I'm getting the labels two times

Twig
I have a registration form - from FOSUserBundle this is in the template: {% form_theme form 'AcmeMyBundle:Form:errors.html.twig' %} <form clas...
7 months ago

How to make Twig template include file in same bundle?

Twig
I'm relatively new to Symfony. I have a bundle with twig templates that are automatically loaded with annotations in a directory structure like: src...
7 months ago