—- plugin —-
description: Provides placeholders to view a campaign email in a browser and to display an archive page of all emails sent to a subscriber
author : Duncan Cameron
lastupdate : 2014-07-12
compatible : phpList 3.0.x
sourcerepo : https://github.com/bramley/phplist-plugin-viewbrowser
The plugin provides a page that displays a campaign email in a browser. The page is accessed by including a placeholder, [VIEWBROWSER] or [VIEWBROWSERURL], in a campaign email.
It also provides an archive page that lists all emails sent to a subscriber. That page is accessed by including a placeholder, [ARCHIVE] or [ARCHIVEURL], in a campaign email.
See the README file on the GitHub page https://github.com/bramley/phplist-plugin-viewbrowser for how to install the plugin.
The text displayed by the plugin can be translated into other languages. See the file plugins/ViewBrowserPlugin/lan/translations_en.php for the English version that can be used as the basis for another language. Each line in the file contains the English text than the equivalent text in the target language.
To create a new language file, copy translations_en.php to translations_xx.php, where xx is the language code, then change the texts for your target language. For the new translations to take effect you need to logout of phpList then login again.
You can share your new language file by submitting it for inclusion in the plugin. Please create a topic in the user forum or an issue on GitHub.
The Settings page has a View in Browser group where you can configure the plugin.
Include the placeholder [VIEWBROWSER] in a message or template. When phpList generates the emails for the campaign, the placeholder will be replaced by a link (an HTML
<a> element) to the view page. The link URL includes the message id and the subscriber's uid.
When a subscriber clicks the link the plugin generates the email as a web page using the message, the template (if used), and by replacing placeholders.
Alternatively, you can use the [VIEWBROWSERURL] placeholder. This is replaced by the same URL that is used for the [VIEWBROWSER] link.
To use [VIEWBROWSERURL] in the link dialogue of CKEditor you need to select “other” as the protocol
You can also refer to a different campaign in these placeholders by using a placeholder of this format [VIEWBROWSER:123] or [VIEWBROWSERURL:123]. These placeholders will be replaced by a link or URL to view the campaign with id 123 instead of the current campaign.
On the Settings page, you can specify the link text, such as “View this email in your browser”. You can change the styling of the link by specifying additional attributes for the
<a> element, such as a specific class or a custom style. For example
When the plugin generates the email as a web page the result will include the link generated by the [VIEWBROWSER] placeholder. If you do not want that to appear in the online version of the email then you can suppress it by wrapping the link and any surrounding text in an element with a class of “viewbrowser”.
For example, if your campaign message includes
<p>If this email isn't displaying correctly [viewbrowser]</p>
then either wrap that within a
<div class="viewbrowser"> <p>If this email isn't displaying correctly [viewbrowser]</p> </div>
or add the class to the
<p class="viewbrowser">If this email isn't displaying correctly [viewbrowser]</p>
The plugin will then remove the complete element that has the “viewbrowser” class when it generates the email as a web page.
You can use a link to an anonymous page, which has the subscriber placeholders removed, by enabling the anonymous page on the Settings page and using a URL of this format but customised for the actual location of phpList and the campaign id
This URL can be used outside of phpList and will allow anyone to view the campaign email.
By default, only campaigns sent to public lists can be viewed in this way. An attempt to view a campaign that was sent to a private list is rejected. You can change this behaviour by specifying IDs of allowed lists on the Settings page.
Include the placeholder [ARCHIVE] in a message or template. When phpList generates the emails for the campaign the placeholder will be replaced by a link to a Campaign Archive page, which lists the campaigns sent to the particular subscriber.
The subject field of each listed campaign is a link to view the campaign in a new browser window.
Alternatively, you can use the [ARCHIVEURL] placeholder. This is replaced by the same URL that is used for the [ARCHIVE] link.
You can display an archive page of campaigns sent to a specific list using a URL of this format, where xxx is the list id
Each campaign will be displayed anonymously with subscriber placeholders removed. The URL can be used outside of phpList to allow anyone to see the campaigns sent to that list.
By default, only public lists can be viewed in this way. An attempt to display an archive for a private list is rejected. You can change this behaviour by specifying IDs of allowed lists on the Settings page.
On the Settings page, the setting to provide an anonymous page must be enabled.
The plugin also provides an archive page showing campaigns sent to the current admin. This is accessed through the menu Campaigns > Campaign Archive.
The CSS styling of the public campaign archive page can be customised by modifying the default styling. The recommended way is to make a copy of the archive.css file with your changes, then enter the URL to that file on the Settings page.
This plugin allows other plugins to transform the email as it is being generated by, for example, replacing some custom placeholders. To do that, the other plugin needs to be listed in the setting “Plugins to be used when creating the email” within the View in Browser group on the Settings page.
In most cases, the default list should not be changed, but another plugin can be added to the set when you know that it is compatible. The recommended way is to raise a topic in the phpList support forum https://discuss.phplist.org/.
Please raise any questions or problems in the user forum https://discuss.phplist.org/.