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

前端 未结 4 1409
说谎
说谎 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:38

    That is because $this->render() returns a Response object. Instead of $this->render(), use $this->renderView().

提交回复
热议问题