8000 feature #4941 Adding a section to emailing showing off absolute_url (… · symfony/symfony-docs@78733c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78733c3

Browse files
committed
feature #4941 Adding a section to emailing showing off absolute_url (weaverryan)
This PR was merged into the 2.7 branch. Discussion ---------- Adding a section to emailing showing off absolute_url Hi guys! | Q | A | ------------- | --- | Doc fix? | no | New docs? | no (but follows from symfony/symfony#13264) | Applies to | 2.7+ | Fixed tickets | n/a I thought we should show off `absolute_url` in a place where you will commonly need it. Thanks! Commits ------- 67efb2b minor tweak thanks to Javier 5ab1adf Adding a section to emailing showing off absolute_url
2 parents 2b87b47 + 67efb2b commit 78733c3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

cookbook/email/email.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,21 @@ an email is pretty straightforward::
123123
}
124124

125125
To keep things decoupled, the email body has been stored in a template and
126-
rendered with the ``renderView()`` method.
126+
rendered with the ``renderView()`` method. The ``registration.html.twig``
127+
template might look something like this:
128+
129+
.. code-block:: html+jinja
130+
131+
{# app/Resources/views/Emails/registration.html.twig #}
132+
<h3>You did it! You registered!</h3>
133+
134+
{# example, assuming you have a route named "login" $}
135+
To login, go to: <a href="{{ url('login') }}">...</a>.
136+
137+
Thanks!
138+
139+
{# Makes an absolute URL to the /images/logo.png file #}
140+
<img src="{{ absolute_url(asset('images/logo.png')) }}"
127141

128142
The ``$message`` object supports many more options, such as including attachments,
129143
adding HTML content, and much more. Fortunately, Swift Mailer covers the topic

0 commit comments

Comments
 (0)
0