My case is quite simple:
The content of this two mail are the same because I use EmailAlternative to send both in the same mail.
body.txt:
{% block message %}{% endblock %}
{{ site_name }} team
-----------------
If you need help contact use at {{ support_mail }}
body.html:
<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<p>{% filter linebreaksbr %}{% block message %}{% endblock %}{% endfilter %}</p>
<p><strong>{{ site_name }} team</strong></p>
<hr/>
If you need help contact use at <a href="mailto:{{ support_mail }}">{{ support_mail }}</a>
</body>
</html>
Of course it is a little bit more complex with translation, css and more than one block.
My wish is to define invitation.txt:
{% block message %}Dear {{ first_name|title }} {{ last_name|upper }},
Your inscription has bee accepted. Welcome!
{% endblock %}
I want to be able to load (body.txt, invitation.txt) and also (body.html, invitation.txt) to get my two html parts.
Edit:
Something like that:
invitation/body.txt:
{% extends body.txt invitation.txt %}
invitation/body.html:
{% extends body.html invitation.txt %}
You can use include
e.g.: invitation.txt:
Dear {{ first_name|title }} {{ last_name|upper }},
Your inscription has bee accepted. Welcome!
invitation/body.txt:
{% extends body.txt %}
{% block message %}
{% include "invitation.txt" %}
{% endblock %}
invitation/body.html:
{% extends body.html %}
{% block message %}
{% include "invitation.txt" %}
{% endblock %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With