JFactory/getFeedParser
From Joomla! Documentation
< API16:JFactory
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Get a parsed XML Feed Source
<! removed transcluded page call, red link never existed >
Syntax[edit]
static getFeedParser($url, $cache_time=0)
Parameter Name | Default Value | Description |
---|---|---|
$url | url for feed source | |
$cache_time | 0 | time to cache feed for (using internal cache mechanism) |
Returns[edit]
mixed Parsed SimplePie object on success, false on failure
Defined in[edit]
libraries/joomla/factory.php
Importing[edit]
jimport( 'joomla.factory' );
Source Body[edit]
public static function getFeedParser($url, $cache_time = 0)
{
jimport('simplepie.simplepie');
if (!is_writable(JPATH_CACHE)) {
$cache_time = 0;
}
$simplepie = new SimplePie($url, JPATH_CACHE, $cache_time);
$simplepie->force_feed(true);
if ($simplepie->init()) {
return $simplepie;
} else {
JError::raiseWarning('SOME_ERROR_CODE', JText::_('JERROR_LOADING_FEED_DATA'));
}
return false;
}
<! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]