| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Document |
JDocumentRendererAtom |
render |
render() |
Never | Work in Progress |
Renders the feed.
Extracts the data from the document object and wraps it into ATOM format feed markup.
string render ()
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.atom' ); $renderer = new JDocumentRendererAtom( $feedDoc ); echo $renderer->render();
might produce:
Result
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"> <title>Feed Title</title> <subtitle></subtitle> <link rel="alternate" type="text/html" href=""/> <id></id> <updated>2007-05-26T02:55:54-04:00</updated> <author> <name>Feed Editor</name> </author> <generator uri="http://joomla.org" version="1.5">Joomla! 1.5 - Open Source Content Management</generator> <link rel="self" type="application/atom+xml" href="http://example.com/feed.php" /> <entry> <title>Item Title</title> <link rel="alternate" type="text/html" href="http://example.com/index.php?item_title"/> <published>2007-05-26T02:55:54-04:00</published> <updated>2007-05-26T02:55:54-04:00</updated> <id>http://example.com/index.php?item_title</id> <author> <name>Joe Blow</name> </author> <summary type="html">About the Item</summary> </entry> </feed>