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...
8 months 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' =&...
8 months 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...
8 months ago

Printing json in Laravel templates

Twig
I'm having trouble in moving Eloquent data to Laravel templates as JSON. The problematic data is user inputted text which has linebreaks, all kinds of...
8 months ago

How to access parent twig templates attributes property?

Twig
I have field.html.twig: {%- for item in items -%} <div{{ item.attributes }}> {{ item.content }} //Calls field-collection-item--field-banner....
8 months 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...
8 months ago

Symfony2 - Searching for objects by user input

Twig
I'm trying to search for objects based on words the user types in, but the search results always come up blank. I know the query is right because if I...
8 months ago

display a table using for twig

Twig
helo everybody i'm usng symfony and html2pdf bundle to generate a pdf file so here's the code that i used to display a table in the pdf file <ta...
8 months ago

How can I set data's in twig from Ajax response

Twig
I can't set data's in twig from Ajax response. ${id} I render content on front-end with jQuery template (use Ajax response), and I can't set data's ...
6 months ago

Use bundle error templates in Symfony 3 app

Twig
I have a MyBundle bundle which I use in many Symfony applications. This bundle provides common things which are shared across these applications, such...
7 months ago

How can I show results count on search results page in Drupal 8?

Twig
I'm trying to display search results count in the result page in Drupal 8, I want to display something like: 23 results for search_word. I'm using th...
7 months ago

How to use CSRF token in Silex 2 via Twig template?

Twig
i've registred a CsrfServiceProvider() $app->register(new Silex\Provider\CsrfServiceProvider()); My form: <form action="{{ url('some.action'...
6 months ago

How to make the 'breadcrumb' variable available in breadcrumb.html.twig available in node--type.html.twig

Twig
There's a variable breadcrumb that is available in breadcrumb.html.twig I have a node type Page on which I need the breadcrumb, because it has to go ...
6 months ago

Symfony VichUploaderBundle Form Theme does not displays element

Twig
On my Symfony 3 project that uses VichUploaderBundle and FosUserBundle I created a form that the user uploads the avatar image: namespace AppUserBund...
6 months ago

Difference between use & include in Twig

Twig
What is the difference between use and include in Twig? Documentation: include The include statement includes a template and returns the ren...
6 months ago

Twig can't find function created inside TwigExtension class

Twig
I am trying to call Twig function created in TwigExtension (Symfony 3.3). Problem is that I can't find what I did wrong and I am not sure why it is no...
6 months ago

twig print field multiple image in field templates

Twig
Here, I have attached my code <div{{ attributes }}> {% if not label_hidden %} <div{{ title_attributes.addClass('field-label') }}...
5 months ago

Twig templating for variables and filters

Twig
Having problems with correct output in October CMS twig: Using - <img src="{{ asset('assets/img/flag-'~code~'.png'|theme) }}" class="flag"> A...
5 months ago

Symfony2 how to render all rows of form in twig

Twig
I built a form in symfony with this code: foreach ( $options as $field => $title ) { $form->add( $field, 'text', array('label' => $title...
5 months ago

Symfony forcing translation into different language than the current one

Twig
I have the locale set to one language. Let's say german "de" and I want to have a part of the whole text translated into different languages (Ex. This...
5 months ago