我有電子郵件和擴展模板的問題。我正在嘗試爲電子郵件構建一個模板,然後在不同的Bundles中爲這些電子郵件使用一個模板。我自己的包,我sucesfully成就了這一點,但是當我嘗試擴展FosUserBundle時出現問題:重置電子郵件。將擴展模板與FOSUserBundle電子郵件不兼容。 Symfony2
我的模板在app /資源/視圖/ email_base.html.twig
{% block subject %}{% endblock subject %}
<div dir="ltr" style="display: block; width: 100%; background: #ffffff">
<div class="gmail_quote">
<div style="margin:0;padding:20px 0; background: #ffffff">
<table align="center" bgcolor="#F9F9F9" cellpadding="0" width="600" style="border-spacing:20px 0;color:#4d4d4d;font-family:Arial,Helvetica">
<tbody>
TROLLOLOLL
{% block body_html %}
{% endblock body_html %}
</tbody>
</table>
<table align="center" bgcolor="#FFFFFF" width="600" style="margin-top:12px;color:#bdbdbd;font-family:Arial,Helvetica;font-size:11px;text-align:justify">
<tbody>
<tr>
<td colspan="4" style="padding-top:10px">
This e-mail is intended solely for the addressee, may contain propriertary and legally privileged information.
If you have received this e-mail by mistake please notify the sender and delete this e-mail along with all attachments.
Thank you.
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
電子郵件,我試圖用我的模板擴展在UserBundle /資源/視圖/復位/ resetting_email.html.twig看起來像:
{% extends '::email_base.html.twig' %}
{% block subject %}Resseting password
{% endblock %}
{% block body_html %}
<tr>
<td colspan=2 style="text-align: left;">
<h3>Witaj {{ user.username }}</h3>
</td>
</tr>
<tr>
<td colspan=2>
<p>Jeśli chcesz zresetować hasło, kliknij w następujący link <a style="color: #EA2227; text-decoration: underline" href="{{ confirmationUrl }}">reset hasła</a>.</p>
</td>
</tr>
{% endblock body_html %}
的問題是,當我發這條短信我只能看到從resetting_email.html.twig內容。並且根本沒有來自base_email.html.twig的內容。
在我的配置文件我設置重置爲我的文件resetting_email.html.twig模板:在那裏我搞砸
fos_user:
db_driver: orm
firewall_name: main
user_class: GL\UserBundle\Entity\User
from_email:
address: [email protected]##########.pl
sender_name: Admin ##########
resetting:
email:
template: GLUserBundle:Resetting:resetting_email.html.twig
service:
mailer: fos_user.mailer.twig_swift
有人可以解釋這樣對我,還是說明了什麼?我會非常不滿意
感謝,這解決了這個問題 – user2576422