Table of Contents

render

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Document Class JDocumentRendererRSS Method render Reference render() Never Work in Progress

Renders the feed.

Extracts the data from the document object and wraps it into RSS format feed markup.

Syntax

string render ()

Examples

Example

$feedDoc =& JDocument::getInstance( 'feed' );
$feedDoc->syndicationURL = 'http://example.com/feed.php';
$feedDoc->copyright = 'Copyleft(C)';
$feedDoc->editor = 'Feed Editor';
$feedDoc->title = 'Feed Title';
$feedDoc->subtitle = 'Feed sub title';


$item = new JFeedItem();
$item->title            = 'Item Title';
$item->link             = 'http://example.com/index.php?item_title';
$item->description      = 'About the Item';
$item->date             = mktime();
$item->author           = 'Joe Blow';
$item->category         = 'General Category';

$feedDoc->addItem( $item );

jimport( 'joomla.document.renderer' );
jimport( 'joomla.document.feed.renderer.rss' );
$renderer = new JDocumentRendererRSS( $feedDoc );
echo $renderer->render();

might produce:

Result

<rss version="2.0">
	<channel>
		<title>Feed Title</title>
		<description></description>
		<link></link>

		<lastBuildDate>Sat, 26 May 2007 03:09:45 -0400</lastBuildDate>
		<generator>Joomla! 1.5 - Open Source Content Management</generator>
		<language>en</language>
		<copyright>Copyleft(C)</copyright>
		<managingEditor>Feed Editor</managingEditor>
		<item>

			<title>Item Title</title>
			<link>http://example.com/index.php?item_title</link>
			<description><![CDATA[About the Item]]></description>
			<author>Joe Blow</author>
			<category>General Category</category>
			<pubDate>Sat, 26 May 2007 03:09:45 -0400</pubDate>

		</item>
	</channel>
</rss>