Compare date with a specific one and DateTime to string in Twig

Twig
How can I compare two dates in Twig when the first one comes from the dababase and the second is clear - 2012-12-31? I tried with {% if dom.dueD...
3 years ago

double-quotes making problems in google

Twig
I used the replace function in twig to remove the unwanted pieces of the function and it is working perfectly except it still contains the double-quot...
3 years ago

IF a == true OR b == true statement

Twig
I can't find a way to have TWIG interpret the following conditional statement: {% if a == true or b == true %} do stuff {% endif %} Am I missing so...
3 years ago

Twig - Replacing double quotation in an href inside data-description

Twig
I'm having trouble building out a data-description which will contain an href. The stored value contains double quotation marks, which obviously cause...
3 years ago

How can I detect if a form has any elements left to be rendered?

Twig
Let's say I am using the Symfony Form Component to render a simple form with only two fields (username and email) I am rendering both fields with for...
3 years ago

Id attribute on form tag symfony

Twig
I would like to define a id attribute on my symfony2 forms. I've tried with this in my twig template: {{ form_start(form, {'id': 'form_person_edit'...
3 years ago

Symfony from styling time widgets

Twig
I am currently trying to style a form that is generated by symfony form builder. there is a bootstrap overlay on it but i want to move the time widg...
3 years ago

symfony2.3 filter twig inside other filter

Twig
i have filter in twig : class AcmeExtension extends \Twig_Extension { public function getFilters() { return array( new \T...
3 years ago

How to handle twig view and bootstrap 3 rows/columns?

Twig
I have an Article entity and I made a findAll() in the controller. I rendered each article in a div with the col-md-6 class. But foreach 2 articles ...
3 years ago

Twig: in_array or similar possible within if statement?

Twig
I am using Twig as templating engine and I am really loving it. However, now I have run in a situation which definitely mustbe accomplishable in a sim...
3 years ago

twig nested loop getting more elements

Twig
I have a nested loop in twig and i get the elements doubled in the form of 1,1,1,1 / 2,2,2,2 / 3,3,3,3. How can i use the first loop to access the dat...
3 years ago

Form tag attributes in Symfony2 / Twig

Twig
When I want to add some attributes to symfony2 form elements I can just use the "attr" attribute. But how can I give some id / class / style / other t...
3 years ago

testing twig with phpunit

Twig
I want to implement some unit tests with Twig and PHPUnit(both installed with composer, with slim/views added). But when I try to test a template gene...
3 years ago

Display something only once in a loop in twig

Twig
I have some pics that I want to display by months. But I my code I get the month on top of every pics. How to avoid this ? {% for media in med...
3 years ago

What is the correct way to concatenate and trim in TWIG

Twig
I'm new to TWIG. I can do this in PHP, but I'm looking for the right way to do it in the template using TWIG. Controller code: public function inde...
3 years ago

How to config twig and Timber to translate full twig templates with {% trans %} tags

Twig
I've been trying to make Timber render and translate templates with {% trans %} tags. I created a .po tranlation file with poedit and Twig-Gettext-E...
3 years ago

JSON encode in Slim framework

Twig
I am having problems sending a JSON encoded array to my view. So I am doing this in my route $data['values'] = array('name'=>'John'); $data['valu...
3 years ago

Symfony2 creating twig extension

Twig
I want to create a simple twig extension ({{imgWidth(...)}}) that calls getimagesize() and returns the width and height of an image on the server. I ...
3 years ago

symfony 2.1 set form theme in controller

Twig
Recently I used setTheme function in symfony 2.0 from Symfony / Bridge / Twig / Extension / FormExtension.php, eg: $this->get('twig')->getExte...
2 years ago

Twig get an option in url

Twig
in a form i would like modify my url when i change my select option. When i do this, i have this in my url : ?extension-filter=&extension-list=10...
2 years ago