我正在使用Latte框架在我的应用程序中生成电子邮件模板。我不需要在模板中使用的变量中进行转义,因为我将其用于不正确转义的内联CSS样式。为了避免转义,我需要使用:
{$style['.ei-section-rows-wrapper']|noescape}我有很多带有内联样式的标签,到处添加"|noescape“会破坏HTML模板文件的可读性。
有没有可能为Latte框架全局设置一些配置,使其不会在我的模板中逃脱任何东西?我假设我可以在下面的代码之后设置一些参数:
$latte = new Latte\Engine;
// Add some custom filter to $latte to disable escaping?..
$email_template = $latte->renderToString(....);发布于 2020-02-25 15:47:35
恐怕在Nette框架中还没有官方的方法来关闭自动转义。
发布于 2021-07-06 00:14:21
{contentType text}完全关闭了转义;请参阅https://latte.nette.org/en/tags#toc-contenttype
https://stackoverflow.com/questions/60096816
复制相似问题