Twig template cannot include php template

后端 未结 3 1521
鱼传尺愫
鱼传尺愫 2021-01-13 10:00

I encountered a problem, which for me is quite not clear and hard to understand. I have tried to make calendar widget, which is supposed to be display on every page on my si

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-13 10:02

    Have you considered rendering your calendar php template by using {% render 'ApplicationBundle:Controller:action' %} and in the action rendering the php template?

    You might also render your calendar php in the action that render calendar twig and pass the output of the php template as a simple twig variable.

    Note: to display such a var, don't forget to do {{ var|raw }} if there is any html tag inside.

    Note2: as of symfony2.2, the render parameter as changed to {% render url('route_name') %}

提交回复
热议问题