Questions tagged as 'twig'

1
answer

Show forms in twig with symfony

I'm trying to make a comment system in symfony but at the moment of rendering the form in a for as follows twig code: {% for publicacion in publicaciones %} {{form(form}} {% endfor %} the form is shown only once and is not shown for...
asked by 15.07.2018 / 02:25
1
answer

How to show the age of a person in Symfony with twig

I have this PHP code that works but I would like to be able to use the same but within twig in symfony. <?php $cumpleanos = new DateTime("1982-06-03"); $hoy = new DateTime(); $annos = $hoy->diff($cumpleanos); echo $annos-...
asked by 31.05.2018 / 01:07
0
answers

Comparison of twig variables in if

I am migrating a web from drupal 7 to 8 in the course of the translation of php templates to twig language, in a logical comparison I have a variable called content [field_type] [0] which stores the type of the page, if I get this varialbe on th...
asked by 11.05.2018 / 10:37
1
answer

How to get the current url in Twig in Symfony

I need to get the final route of the url in twig For example I have this url: http://www.hackeruna.com/pagina , I just need this part of the path /pagina .     
asked by 04.05.2018 / 00:42
0
answers

Problem when rendering twig ez-platform

I'm delving into the world of EZ Platform trying to render a pagelayout with their respective content types. The problem I have is the inheritance of the contents to render. I explain. In my project I have a% main% co that loads all...
asked by 18.04.2018 / 09:04
1
answer

Rendering views with Twig

I uploaded my project to a free shared hosting. I do not render the views as they should be, that is, everything loads me well but does not show content, only the blank page appears. I tried placing a php page with conventional html and everythi...
asked by 04.03.2018 / 21:03
1
answer

show in twig the result of a JOIN query in Symfony

I have 2 tables which are not related by ORM so I do the JOIN in the following way: $dql="Select u, o from BackendBundle:Orders o JOIN BackendBundle:Users u WITH o.userid=u.id"; $query=$em->createQuery($dql);...
asked by 01.08.2017 / 19:39
0
answers

Link with twig in symfony 2

I have the following problem, I want to use a template for my appweb but I have the following query: <li><a href="javascript:void(0)" class="waves-effect"><i class="fa fa-renren"></i> <span class="hide-menu">Ayl...
asked by 25.07.2017 / 17:44
1
answer

How to create an extension twig in symfony that returns the day of the week?

How you can create an extension in twig, that does the same as this PHP code: public function nombredia($nombredia) { $dias = array('','Lunes','Martes','Miercoles','Jueves','Viernes','Sabado','Domingo'); $fecha = $dias[date('N', strt...
asked by 26.05.2017 / 00:32
1
answer

modify elements of a Block view Drupal 8

Good afternoon, I have created a block view with its respective template, I put it below: {% set classes = [ 'block', 'block-' ~ configuration.provider|clean_class, 'block-' ~ plugin_id|clean_class, ] %} <div{...
asked by 06.01.2017 / 19:41