How to render Twig template from database in symfony2

前端 未结 11 994
闹比i
闹比i 2020-12-08 04:21

I\'m working on application written in symfony2 and I want to send email after some action/event... the problem is, that the users can define something like \"email template

11条回答
  •  攒了一身酷
    2020-12-08 05:08

    As of Twig 1.10, the Twig Engine doesn't support rendering strings. But there is a bundle available which adds this behavior called TwigstringBundle.

    It adds the $this->get('twigstring') service wich you can use to render your strings.

    (As September '19, the current version of Twig is 2.X, and version 3 is around the corner; so this is only applies to very old versions of Twig).

提交回复
热议问题