Get csrf token in form Symfony2

Twig
Use this code to retrieve the csrf token in the Symfony2 form.
2 years ago

Twig replace text

Twig
Example how to replace text in a string with Twig.
2 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...
1 year 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...
1 year 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...
1 year 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'...
1 year 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...
1 year 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 ...
1 year 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...
1 year 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...
1 year 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...
1 year 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 ...
1 year 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...
1 year 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...
1 year 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...
1 year ago

Symfony2 - Hyperlink to an exterior url retrieved from database using TWIG

Twig
i'm using symfony 2.0.19, and i'm trying to create a hyperlink to an external URL, this URL is retrieved from database, i tried doing this <td>...
1 year ago

Prevent quotes from being converted to HTML entities in twig ternary operator

Twig
The following does not convert the quotes to HTML entities {% for row in files %} <tr data-id="{{ row.id }}"><td>{{ row.name }}</td&...
1 year ago

how does "{% use %}" work in twig using symfony3?

Twig
I'm trying to use the {% use %} syntax to import the blocks from a child template in my base template as described in http://twig.sensiolabs.org/doc/t...
1 year 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...
1 year 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...
1 year ago