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 MarkupRSS class also inherits all the methods and properties of: WireData and Wire.

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
MarkupRSS::render()
boolRender the feed and echo it (with proper http header) 
MarkupRSS::renderFeed()
stringRender the feed and return it 

Properties

NameReturnSummaryDefault
MarkupRSS::copyright string 
MarkupRSS::css string 
MarkupRSS::description string 
MarkupRSS::feedPages array PageArray 
MarkupRSS::header string 
MarkupRSS::itemAuthorElement string 
MarkupRSS::itemAuthorField string  
MarkupRSS::itemContentField string 
MarkupRSS::itemDateField string 
MarkupRSS::itemDescriptionField string Field to use for item description. 
MarkupRSS::itemDescriptionLength string Max length for item description or 0 to allow HTML markup with any length 1024
MarkupRSS::itemTitleField string 
MarkupRSS::stripTags bool Strip tags from item description? Applies only if `itemDescriptionLength>0`. true
MarkupRSS::title string 
MarkupRSS::ttl int 
MarkupRSS::url string 
MarkupRSS::xsl string 

Additional methods and properties

In addition to the methods and properties above, MarkupRSS also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.251