Symfony2 - checking if file exists

Twig
I have a loop in Twig template, which returns multiple values. Most important - an ID of my entry. When I didn't use any framework nor template engine...
11 months ago

document.write javascript function is not working

Twig
I'm trying to use the document.write javascript function to set an external css file in my template, but, I want to do this via Twig just like this: ...
11 months 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 ...
11 months ago

Get Template Directory Timber/Twig

Twig
I have a setup a simple twig template which is used to display a simple menu. I have images in here that are static and I would like use the template ...
11 months ago

Sending variable from volt to custom function

Twig
I have created a custom function I can access from the volt. The function seems to work fine, but I cannot manage to send the variable to the function...
11 months ago

Extending stylesheet block

Twig
I have stylesheet block in base layout: {% stylesheets filter='cssrewrite' 'bundles/static/css/main.css' %} <link rel="styleshe...
11 months ago

Output array in Twig

Twig
I trying to output array from database to screen. In my entity: /** * @ORM\Column(type="array", nullable=true) */ private $category; In my twig ...
11 months ago

Can't exploit properly an array with twig

Twig
I created an entity that I want to use to save events such as "[this user] accepted / declined the mission". So far I have no problem to save the even...
11 months ago

Accessing the logged-in user in a template

Twig
I'm using FOSuserbundle to get started with User registration https://github.com/FriendsOfSymfony/FOSUserBundle I've got it registering / logging in ...
11 months ago

Generating Table Content with TWIG in for loop

Twig
I've got a table, that content got generated in a twig template. Every column that got generated executes the code below. What I need to do is the f...
11 months ago

Twig include CSS or Java Script

Twig
I am completely new to Twig. I have a Twig project, but I do not manage to configure paths to css and js file in the project. The packages I have ins...
11 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." }, { ...
11 months ago

Add div after every 3d element twig loop, modulus

Twig
Hi so i have this twig loop, and what i need to to is after every 3rd element to add some html to close div row and open new one. I tried with variou...
11 months ago

Symfony: passe parameter to Ajax url

Twig
I am trying to figure out how to enable/disable user with checkbox without page reload. index.html.twig <table> <thead> <tr>...
11 months 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...
11 months ago

Symfony and Twig, prerender, parse view, replace content

Twig
I need replace some content in every file of view. But content in many places is just a text, not a variable, co i cant use variable|replace() filter....
11 months ago

Pass include path from variable with Twig?

Twig
I need to include child-1.twig and child-2.twig in component.twig, and include component.twig in page.twig. In my page.twig: {% set items = [ '{%...
11 months ago

PHP Twig Error: Object of class __TwigTemplate_XYZ could not be converted to string

Twig
Hey and good morning :). I'll start with the error message and explain afterwards what I've tried and did: Catchable fatal error: Object of class __...
11 months ago

How to use an image style in a Drupal 8 twig template?

Twig
I am trying to print an image using an image style that I've created in my drupal 8 theme. I can print an image in a template by doing {{ content.ban...
11 months ago

Passing Twig variables from array into an include

Twig
I have an array I'm iterating over to pull in different types of components into my page: array( 'content'=> array( 'componentA'=>a...
11 months ago