Actions

API16

JFactory/getFeedParser

From Joomla! Documentation

< API16:JFactory
Revision as of 00:06, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Get a parsed XML Feed Source

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

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

mixed Parsed SimplePie object on success, false on failure

Defined in

libraries/joomla/factory.php

Importing

jimport( 'joomla.factory' );

Source Body

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 edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />