User Tools

Site Tools

Translations of this page:

plugin:viewinbrowser

View in browser

Compatible with version

phplist 3.0.x

plugin Provides placeholders to view a campaign email in a browser and to display an archive page of all emails sent to a subscriber

Last updated on
2014-07-12
Repository
Source
By Duncan Cameron

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.

Installation

See the README file on the GitHub page https://github.com/bramley/phplist-plugin-viewbrowser for how to install the plugin.

Translations

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 then 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.

Configuration

The Settings page has a View in Browser group where you can configure the plugin.

  • The text to be used in the view in browser link.
  • The text to be used for the archive page link.
  • Additional attributes to be used to style the links.
  • Whether the plugin should provide an anonymous page.
  • Restrict anonymous access to public lists or to specific lists.
  • Plugins to be used when creating the web page.
  • The number of items to display on each campaign archive page.
  • URL to a custom CSS file to style the campaign archive page.

Usage

View in browser placeholders

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.

Styling

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

  class="myclass"

or

  style="color: #ea5b0c;"

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 element

<div class="viewbrowser">
<p>If this email isn't displaying correctly [viewbrowser]</p>
</div>

or add the class to the p element

<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.

Anonymous pages

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

  http://www.mysite.com/lists/?m=36&p=view&pi=ViewBrowserPlugin

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.

Archive page placeholders

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.

Anonymous archive page

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

  https://mysite.com/lists/?p=archive&pi=ViewBrowserPlugin&list=xxx

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.

Admin archive page

The plugin also provides an archive page showing campaigns sent to the current admin. This is accessed through the menu Campaigns > Campaign Archive.

Styling

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.

Integration with other plugins

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/.

Support

Please raise any questions or problems in the user forum https://discuss.phplist.org/.

plugin/viewinbrowser.txt · Last modified: 2018/10/25 09:52 by duncanc

Resources
Contact Us

e: info@phplist.com

Boring Bit

phpList is a registered limited company

UK Company No. 07582966

VAT Registration 122 0788 37

© phpList 2016