Twig include twig sub template with variables

Twig
Example how to include a sub twig template and passing objects to the sub template.
1 year ago

Get csrf token in form Symfony2

Twig
Use this code to retrieve the csrf token in the Symfony2 form.
1 year ago

Symfony2 generate csrf token via Form widget

Twig
If your not sure how to generate the CSRF token for your current object that is stated in the form, you can generate the csrf form element by using th...
1 year ago

Twig render data from other controller and action

Twig
This example will get data to use in the twig template that is provided by an other controller and action.
1 year ago

Twig display current date

Twig
With this example you can display the current date in a Twig template.
1 year ago

Symfony2 Twig display current date

Twig
This example will display the current date in your twig template.
1 year ago

Twig display day anme by date

Twig
Example how to display the day name by provided date.
1 year ago

Symfony2 Twig form label with HTML markup

Twig
Example how to generate correct HTML markup in the form label.
1 year ago

Twig replace text

Twig
Example how to replace text in a string with Twig.
1 year ago

Symfony2 Twig generate url by route name

Twig
1 year ago

Twig convert DateTime to date string format

Twig
Example how to convert a PHP DateTime object to a string in Twig.
1 year ago

Twig convert date to localized date

Twig
11 months ago

Twig - how to detect last item in loop

Twig
Example how to detect the last item in a loop in Twig.
10 months ago

SF2 Twig : How to customize rendering of CoolectionType embedded in CollectionType?

Twig
I'm designing an app with a Survey entity. Each survey can have multiple SurveyQuestion entities (CollectionType in form, attribute Survey->questions)...
9 months ago

How to translate labels in symfony forms generated with doctrine:crud

Twig
There Symfony project. He has Entity/Record.php With the command php bin/console generate:doctrine:crud --entity=AppBundle:Record Create a controlle...
9 months ago

Symfony template generation via doctrine:crud

Twig
There Symfony project. He has Entity/Record.php With the command php bin/console generate:doctrine:crud --entity=AppBundle:Record Create a controlle...
9 months ago

Twig Check for partial existence before include

Twig
I am working on a fairly complex multi lingual site that will render different partials based on the html locale. I have a partial structure that wi...
9 months ago

How to replace string with variable in Twig

Twig
{% image '@AppBundle/Resources/public/images/florida.png'%} <img src="{{ asset_url }}" alt="Example" height="200" width="200"/> {% endimage ...
9 months ago

Twig Compare a parameter passed to a template inside the template

Twig
In Twig I successfully render a template and pass to it the following array with values: $params = array( 'value1' => '...
9 months ago

Get two random items from a list in Twig

Twig
I have a list of items in Twig, that looks like this. {% set listItems = [ { "name":"Bob","title":"Director","text":"Bob like burgers." }, { ...
9 months ago