$feedurl = 'https://example.com/news/feed'; $parser = JFactory::getFeedParser(); $feed = $parser->parse($feedurl); foreach($feed->items as $item) { echo '' . $item->title . '
'; echo '' . $item->description . '
'; }
$feedurl = 'https://example.com/blog/atom'; $parser = JFactory::getFeedParser(); $feed = $parser->parse($feedurl); $count = 0; foreach($feed->items as $item) { if ($count++ >= 5) break; echo 'In this example, we retrieve an Atom feed instead of an RSS feed. We also limit the number of items to 5 by using a counter variable and the break statement. Overall, the JFactory getFeedParser function is a useful tool for developers working with Joomla! CMS who need to include external feeds in their websites.' . $item->title . '
'; echo '' . $item->content . '
'; }