Adding a link for an RSS feed to the document

From Joomla! Documentation

Revision as of 19:40, 14 November 2009 by Chris Davenport (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To add a link for an RSS feed to the document, you could use:

$doc =& JFactory::getDocument();
$href = '/joomla/index.php?format=feed&type=rss'; 
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); 
$doc->addHeadLink( $href, 'alternate', 'rel', $attribs );

When the document is rendered this will produce the following in the HTML <head> section:

<link href="/joomla/index.php?format=feed&amp;type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" />