如何在树枝模板中输出胡须模板? [英] How to output mustache templates in a twig template?

查看:65
本文介绍了如何在树枝模板中输出胡须模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用symfony2将胡须模板添加到Twig模板中.

I need to add mustache templates to a Twig template using symfony2.

有人为django创建了一个"verbatim"模板标签,而我正在为树枝寻找一个相应的标签,以防止其解析胡须元素.

Someone has created a 'verbatim' template tag for django and I'm looking for a corresponding one for twig that will prevent it from parsing the mustache elements.

有人可以指出我的正确方向吗?

Can anyone point me in the right direction please?

谢谢

推荐答案

我认为您正在寻找但是,如果您需要逐字写{% endverbatim %}怎么办? 然后,您必须诉诸最小的优雅方法(您不能再使用逐字记录)

But what if you need to write {% endverbatim %} verbatim ? You must then resort to the least elegant method (you can't use verbatim anymore)

{{'twig code here{% endverbatim %}twig code there' }} 

如果树枝代码很大,请执行以下操作:

If the twig code is big, do this:

{% verbatim %}
    twig code here
{% endverbatim %}
{{ '{% endverbatim %}' }}
{% verbatim %}
    twig code there
{% endverbatim %}

这篇关于如何在树枝模板中输出胡须模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆