10000 Adding a section to emailing showing off absolute_url by weaverryan · Pull Request #4941 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Adding a section to emailing showing off absolute_url #4941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adding a section to emailing showing off absolute_url
  • Loading branch information
weaverryan committed Mar 13, 2015
commit 5ab1adf12eba4204dbfcf23a3f7c46c68729e6ed
16 changes: 15 additions & 1 deletion cookbook/email/email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,21 @@ an email is pretty straightforward::
}

To keep things decoupled, the email body has been stored in a template and
rendered with the ``renderView()`` method.
rendered with the ``renderView()`` method. The ``registration.html.twig``
template might look something like this:

.. code-block:: html+jinja

{# app/Resources/views/Emails/registration.html.twig #}
<h3>You did it! You registered!</h3>

{# example, assuming you have a route named "login" $}
To login, go to: {{ url('login') }}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor comment: in the rest of this template we use HTML tags. Maybe we should replace {{ url('login') }} by <a href="{{ url('login') }}">...</a> to create a real link?


Thanks!

{# Makes an absolute URL to the /images/logo.png file #}
<img src="{{ absolute_url(asset('images/logo.png')) }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no PHP template? 😿

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this new function only exists for Twig: https://github.com/symfony/symfony/pull/13264/files

If there's some solution for PHP, I certainly don't mind putting it in. All I know of is to hack something in by getting the domain off of the request object

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, indeed. I'll open an issue there (imo, 2.7 should still support PHP templating, no matter what will happen in 3.x)


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