【问题标题】:TPL email template in Symfony2Symfony2 中的 TPL 电子邮件模板
【发布时间】:2014-01-24 08:52:18
【问题描述】:

我使用了一个非常简单的模板 (.tpl) 在我的 php 应用程序中接收电子邮件。一些类似的:

Date    : {date}
Name    : {name}
Mail    : {email}
Subject : {subject}

{message}

现在,我已将此应用程序迁移到 Symfony,¿如何使用此模板?

如果我这样做:

$this->renderView('MyBundle:Template:support.tpl', $params), 'text/html');

这在 Symfony2 中不起作用。

有什么想法吗?? 谢谢!

【问题讨论】:

    标签: php email templates symfony view


    【解决方案1】:

    Symfony 不知道 .tpl 文件和你的语法。只需使用树枝!

    Date    : {{ date }}
    Name    : {{ name }}
    Mail    : {{ email }}
    Subject : {{ subject }}
    
    {{ message }}
    

    当然你的文件必须以.twig结尾

    $this->renderView('MyBundle:Template:support.txt.twig', $params);
    

    【讨论】:

    • 感谢您的帮助! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-12
    相关资源
    最近更新 更多