Symfony the same variable for all Twig templates

Twig
I am writing my own CMS using Symfony 3 right now and i have problem with include the same variables in all controllers. For example: I want render ...
2 years ago

Twig if statement not including escaped code

Twig
I'm using Twig in Symfony3 and in my view I have an if statement. The html isn't rendered but the escaped twig does get rendered. Here's my code: {%...
2 years 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...
2 years ago

General PHP TWIG conventions

Twig
I've a simple PHP news application. It's not MVC, just procedural PHP. However, I am thinking about using Twig for frontend. I have been reading the d...
2 years ago

Insert html code in Twig

Twig
I´m trying to insert dynamic links in a twig template, but when I render the page it shows the raw HTML. I send the variables as an array ('fact' =&...
2 years 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' %} {{ ...
2 years ago

Use Twig in CSS

Twig
I would like to give style values using Twig variables. CSS .postit{ width:200px; height:400px; border:1px solid #FFCB00; position;a...
2 years 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...
2 years ago

Twig string comparison always evaluates to true

Twig
I am having a hard time comparing strings in a Twig template. The following example always evaluates to true, even though the res.website clearly cont...
2 years 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 ...
2 years 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>...
2 years 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...
2 years 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...
2 years 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" ...
2 years 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...
2 years 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...
2 years 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...
2 years 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...
2 years 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...
2 years 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...
2 years ago