How to render TWIG output to a variable for later use (symfony2)?

前端 未结 4 1408
说谎
说谎 2021-02-04 02:48

Instead of doing this rendering of each slide in my TWIG like this (see line 6):

{# loop out the slides #}
{% for c in contents %}
    {% set i=i+1 %} {# increas         


        
4条回答
  •  被撕碎了的回忆
    2021-02-04 03:15

    You can get content form rendered object like this:

    $this->render('BizTVArchiveBundle:ContentTemplate:Some.html.twig', array())->getContent();
    

提交回复
热议问题