MarkupRSS class
Given a PageArray of pages, this module will render an RSS feed from them.
This is intended to be used directly from a template file. See usage below.
USAGE
$rss = $modules->get('MarkupRSS');
$rss->setArray([ // specify RSS feed settings
'title' => 'Latest updates',
'description' => 'The most recent pages updated on my site',
'itemTitleField' => 'title',
'itemDateField' => 'created', // date field or 'created', 'published' or 'modified'
'itemDescriptionField' => 'summary',
'itemDescriptionLength' => 1000, // truncate descriptions to this max length or 0 to allow HTML
'itemContentField' => 'body', // optional HTML full-content, or omit to exclude
'itemAuthorField' => 'author', // optional text or Page field containing author(s)
]);
$items = $pages->find('limit=10, sort=-modified'); // or any pages you want
$rss->render($items);
exit; // exit now, or if you don’t then at least stop sending further output
See also the $defaultConfigData below (first thing in the class) to see what options you can change at runtime.
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Markup
class also inherits all the methods and properties of: WireData and Wire.
Common
Name | Return | Summary | |
---|---|---|---|
Markup Markup Markup | bool | Render the feed and echo it (with proper http header) | |
Markup Markup Markup | string | Render the feed and return it |
Properties
Name | Return | Summary | Default |
---|---|---|---|
Markup | string | ||
Markup | string | ||
Markup | string | ||
Markup | array PageArray | ||
Markup | string | ||
Markup | string | ||
Markup | string | ||
Markup | string | ||
Markup | string | ||
Markup | string | Field to use for item description. | |
Markup | string | Max length for item description or 0 to allow HTML markup with any length | 1024 |
Markup | string | ||
Markup | bool | Strip tags from item description? Applies only if `itemDescriptionLength>0`. | true |
Markup | string | ||
Markup | int | ||
Markup | string | ||
Markup | string |
Additional methods and properties
In addition to the methods and properties above, Markup
API reference based on ProcessWire core version 3.0.251