You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A client of mine often includes videos in their newsletters. Since this is not really possible in an email, I only include a cover-image of the video with a link to the web-view of the newsletter in place of the video. When the user clicks on the link it opens the web-view and the video is loaded in place of the cover-image.
To implement this, I have to check whether the current render is a web-view or the email-view. It would be very handy to have a variable in place like isWebRequest to check for this.
Right now I use the following code:
{% ifcraft.app.controllerisinstance of('craft\\controllers\\TemplatesController') %}
<mjml...>display video</mjml>
{% elseif (craft.app.controllerisinstanceof ('craft\\controllers\\QueueController')) or (craft.app.controllerisinstanceof ('putyourlightson\\campaign\\controllers\\SendoutsController')) %}
<mj-imagehref="{{browserVersionUrl}}"target="_blank" /> Link to web-version</mjml-image>
{% endif %}
This works for the sendout-preview and the sent mail, but not for test-mails. Therefore it would be really handy to have a variable or function to check for this.
The text was updated successfully, but these errors were encountered:
Looked into this and there are some other things that you should be able to check for to determine whether this is a web request or not, the simplest being whether the variables variable is defined.
{% ifvariablesisdefined %}
This is a web request.
{% endif %}
A client of mine often includes videos in their newsletters. Since this is not really possible in an email, I only include a cover-image of the video with a link to the web-view of the newsletter in place of the video. When the user clicks on the link it opens the web-view and the video is loaded in place of the cover-image.
To implement this, I have to check whether the current render is a web-view or the email-view. It would be very handy to have a variable in place like
isWebRequest
to check for this.Right now I use the following code:
This works for the sendout-preview and the sent mail, but not for test-mails. Therefore it would be really handy to have a variable or function to check for this.
The text was updated successfully, but these errors were encountered: