Skip to content
Advertisement

Tag: twig

How to pass variable name from controller to twig file in Symfony?

I need to display image at my twig file. I am passing filename information as below: In my twig file, when I put the filename directly it works. But, I am not sure how to pass filename from controller to twig html file. I already tried following lines: It didn’t worked. Can anybody please help. Answer Use concatenation for argument

How to set if clause in twig?

I have these two functions: $object is Datetime object fetched from db. and I also registered functions as twig filter. For a voting system I have two fields start_date and expiry_date, I want to see if this is not expired but already started. In twig I have: I mean I want to see categoryName as link only if this is

Unable to find template Symfony 4

When I updated from Symfony 3.4 to Symfony 4 and displayed the system with a browser, the following error appeared. Changing the views directory is a lot of work and I don’t want to do it as much as possible. Is there any good way? Error Code Code framework.yaml twig.yaml SecurityController.php Version Symfony 4.0 PHP 7.3 twig/twig 2.14 twig/templating 4.0

Replace a string with array values in Twig

I searched on Google for some options to replace a string with some array values in Twig, but I couldn’t find anything useful. Is it possible to replace a string with array values in Twig? I tried to …

Twig templates don’t show updates. Symfony 4.3

After I edit my twig templates, they don’t load on the page. I have a header and footer twig file which are included in my base.html.twig. When i edit these files, the changes aren’t pushed trough when i reload the page. I’ve tried clearing the cache and i disabled cache in configpackagestwig.yaml I even tried to completely delete the cache

How to Manage Assets in yii2 using twig in child template?

I want to extend my base twig template with some asset bundles and add new assets in child template. So I got error “A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?” So need I to set each asset to blocks? That is uncomfortable

Advertisement