meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:rssfeed [2024/12/22 12:38] – [Retrieving RSS feed items] duncancplugin:rssfeed [2026/02/17 13:56] (current) – [Formatting the feed items] duncanc
Line 18: Line 18:
 ====== Purpose ====== ====== Purpose ======
  
-This plugin lets you create campaigns that include content from RSS and Atom feeds and are automatically repeated at regular intervals.+This plugin lets you create campaigns that include content from an RSS or Atom feed and which are automatically repeated at regular intervals.
 So, for example, you can have a campaign that is sent every day at 09:00 which contains items from an RSS feed that were published in the previous day. So, for example, you can have a campaign that is sent every day at 09:00 which contains items from an RSS feed that were published in the previous day.
  
Line 29: Line 29:
 ===== Creating an RSS campaign ===== ===== Creating an RSS campaign =====
  
-==== Add an RSS feed ====+==== Add feed ====
  
-The plugin adds a tab to the Send a campaign page on which you specify the URL of the RSS feed.+The plugin adds a tab to the Send a campaign page on which you specify the URL of the RSS or Atom feed.
 You should validate the URL first, by opening it in a browser, to ensure that it is valid and returns what you expect. You should validate the URL first, by opening it in a browser, to ensure that it is valid and returns what you expect.
 Additionally you can choose whether feed items should be displayed in ascending order of publication date (oldest first) or in descending order (latest first). Additionally you can choose whether feed items should be displayed in ascending order of publication date (oldest first) or in descending order (latest first).
Line 106: Line 106:
 ==== Formatting the feed items ==== ==== Formatting the feed items ====
  
-When phplist is building the email to be sent the plugin replaces the [RSS] placeholder in the message content by the available feed items, each of which is formatted using an RSS template. The default RSS template is specfied on the Settings page, but each campaign can have a custom RSS template, which is entered on the RSS tab.+When phplist is building the email to be sent the plugin replaces the [RSS] placeholder in the message content by the available feed items, each of which is formatted using an RSS template. The default RSS template is specified on the Settings page, but each campaign can have a custom RSS template, which is entered on the RSS tab.
  
-The template consists of html containing placeholders that will be replaced by fields from the item: +In the template placeholders that will be replaced by fields from the item:
-  * [CONTENT]+
   * [TITLE]   * [TITLE]
   * [URL]   * [URL]
   * [PUBLISHED]   * [PUBLISHED]
 +  * [AUTHOR]
 +  * [DESCRIPTION]
 +  * [CONTENT]
  
-The source of the content depends on the type of feed. For an RSS feed the ''description'' field is used if present, otherwise the ''content'' fieldFor an Atom feed the ''summary'' field is used if present, otherwise the ''content'' field. +A feed item may provide a short summary instead of, or as well as, the full content. The [DESCRIPTION] placeholder will be replaced by the RSS ''description'' or Atom ''summary'' element if present, otherwise replaced by the full content. The [CONTENT] placeholder will be replaced by the ''content'' element from the feed if present, otherwise replaced by the short content.
-The published date is formatted using a configuration setting. The default is to display as dd/mm/yyyy hh:mm.+
  
 Additionally, placeholders for custom tags can be included. The placeholders must match exactly the custom tags entered on the Settings page. Additionally, placeholders for custom tags can be included. The placeholders must match exactly the custom tags entered on the Settings page.
Line 128: Line 129:
  
 The template is on the Settings page in the RSS Settings group. The template is on the Settings page in the RSS Settings group.
 +
 +=== Formatting the published date ===
 +
 +If the php ''intl'' extension is enabled then the plugin will format the published date in the language of the feed, which is identified by the ''<language>'' element. The date is formatted using a format string containing placeholders as explained at [[https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table| https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table]]. This allows month and weekday names to be in the feed's language. For example, this shows the published date formatted in Spanish
 +{{:plugin:rss12.png?nolink&500|}}
 +
 +If the php ''intl'' extension is not enabled or the feed does not identify its language then the plugin will format the published date using the php ''date()'' formatting as described at [[https://www.php.net/manual/en/datetime.format.php|https://www.php.net/manual/en/datetime.format.php]]. In this case month and weekday names will be in English.
 ==== Send a test message ==== ==== Send a test message ====
  
Line 183: Line 191:
 ===== Deleting RSS feed items ===== ===== Deleting RSS feed items =====
  
-Once feed items have been included in a campaign there is no need to keep them in the phplist database. To delete items older than a number of days use the menu Campaigns > Delete outdated RSS items. You can also select to delete feeds that have no items and are not used by any campaigns.+Once feed items have been included in a campaign there is no need to keep them in the phplist database. To delete items older than a number of days use the menu Campaigns > Delete outdated RSS items. You can also select to delete unused feeds, those that have no items and are not used by any campaigns.
  
-The command can also be automated using a cron job.  The command will be similar to this (but adjust for the directory in which phplist is installed). The ''-d'' parameter is the number of days for which to keep feed items. The optional ''-u'' parameter is whether to delete unused feeds, a value of 1 to delete unused feeds.+The command can also be automated using a cron job.  The command will be similar to this (but adjust for the directory in which phplist is installed). The ''-d'' parameter is the number of days for which to keep feed items. The optional ''-u'' parameter is whether to delete unused feeds.
 The ''-c'' parameter is required only if the ''config.php'' file is not in the default location of the ''lists/config'' directory. The ''-c'' parameter is required only if the ''config.php'' file is not in the default location of the ''lists/config'' directory.
  
-''php /home/xxx/public_html/lists/admin/index.php -p delete -m RssFeedPlugin -d 99 -u -c /home/xxx/public_html/lists/config/config.php''+''php /home/xxx/public_html/lists/admin/index.php -p delete -m RssFeedPlugin -d 99 -u -c /home/xxx/public_html/lists/config/config.php''
  
 You can also run the command as a remote page if you have a limited cron capability. This approach fetches the page using a linux command such as wget or curl. The URL requires the //Secret for remote processing// value from the phplist Settings page. The ''days'' parameter is the number of days for which to keep items. The optional ''unusedfeeds'' parameter is whether to delete unused feeds. This method requires phpList 3.3.7 or later. You can also run the command as a remote page if you have a limited cron capability. This approach fetches the page using a linux command such as wget or curl. The URL requires the //Secret for remote processing// value from the phplist Settings page. The ''days'' parameter is the number of days for which to keep items. The optional ''unusedfeeds'' parameter is whether to delete unused feeds. This method requires phpList 3.3.7 or later.
  
-''wget -O rssdelete.out '%%https://mysite.com/lists/admin/?page=delete&pi=RssFeedPlugin&days=99&secret=xxxxxxxx'%%''+''wget -O rssdelete.out '%%https://mysite.com/lists/admin/?page=delete&pi=RssFeedPlugin&days=99&unusedfeeds=&secret=xxxxxxxx'%%''
  
  
 +==== Deleting all items ====
  
 +During testing of an RSS campaign it can be useful to remove all items so that the feed can be re-fetched. The page has a **Reset feeds** function which will delete all items and reset the ''etag'' and ''lastmodified'' fields for each feed.
 ===== View email in browser ===== ===== View email in browser =====
  
Line 268: Line 278:
   * Text to append when the title of the latest item is used in the subject.   * Text to append when the title of the latest item is used in the subject.
   * Additional feed elements that should be included in each item's data.   * Additional feed elements that should be included in each item's data.
-  * The format to be used to display the published date. +  * The php ''date()'' format to be used to display the published date. This is used when the php ''intl'' extension is not enabled
-  * Whether to filter item content for whitelisted tags only. The default is to filter. +  * The php ''IntlDateFormatter'' format to be used to display the published date. This is used when the php ''intl'' extension is enabled.
-  * Whether to generate special content when an item's URL field is to YouTube or to a pdf file. The default is not to generate the special content+
-  * The maximum size of the HTTP body of the feed response. +
-  * Whether to use the summary content or full content for the [CONTENT] placeholder. +
-The set of whitelisted tags are +
- +
-'''audio', 'video', 'source', 'dt', 'dd', 'dl', 'table', 'caption', 'tr', 'th', 'td', 'tbody', 'thead', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'strong', 'em', 'code', 'pre', 'blockquote', 'p', 'ul', 'li', 'ol', 'br', 'del', 'a', 'img', 'figure', 'figcaption', 'cite', 'time', 'abbr', 'iframe', 'q', 'sup', 'sub'''  +
- +
-When an item's URL field (taken from the ''link'' element) is a URL to a YouTube video or to a pdf file then the plugin can generate special content instead of using the ''summary'', ''description'' or ''content'' elements. +
- +
-<code html><link href="https://www.youtube.com/watch?v=99999999"/> +
-<link href="https://example.com/document.pdf"/></code> +
- +
-For a YouTube video the content will be an iframe element that refers to the video. This is not really useful because many email clients will not display an iframe element.+
  
-<code html><iframe width="560" height="315" src="//www.youtube.com/embed/99999999" frameborder="0"></iframe></code>+The plugin used to have settings for allowing only whitelisted tags, generating special content for a Youtube URL, and specifying the maximum size of the HTTP responseThese were specific to the Picofeed package which is no longer used.
  
-For pdf file the content will be link to the file. +There was also setting for whether to use a feed item's ''description'' element or ''summary'' element. This setting is no longer needed because the plugin now provides ''[DESCRIPTION]'' placeholder in addition to the ''[SUMMARY]'' placeholder.
-<code html><a href="https://example.com/document.pdf" target="_blank">https://example.com/document.pdf</a></code>+
  
 {{:plugin:rss7.png?nolink|}} {{:plugin:rss7.png?nolink|}}