Feedgrabber extension

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Re: Feedgrabber extension

Postby jz1977 » Fri Nov 04, 2011 8:51 am

Hello,

I've been messing around with multi categories and how to do it, and i came across an idea that almost works. but it's missing something.
I Decided to use a pipe to separate the feed and cat (feed|category)

Snapshot of feedgrabber_config.php
Code: Select all
$feedgrabber_config = array(
    'feeds' => array(
        'http://domain.com/rss2/sports.php|Sports',
   'http://domain.com/rss2/weather.php|Weather',
   'http://domain.com/rss2/news.php|News'
    ),
    'user' => 'someuser',
    'status' => 'publish',
    'allow_comments' => false,
    'update_items' => true


Notice i added
Code: Select all
$splitfeedurl = explode('|', $feedurl);


Snapshot of hook_feedgrabber.php
Code: Select all
    foreach($feedgrabber_config['feeds'] as $feedurl) {
      $splitfeedurl = explode('|', $feedurl);
        $rss = fetch_rss( $splitfeedurl[0] );
// echo $splitfeedurl[0]." ";
        debug("Checking feed ". $rss->channel['title'] . ". ". count($rss->items) . " items.");

        if ($rss->items) {

            $amount = 0;

            foreach($rss->items as $item) {

                $entry = array();

                $id = getDefault($item['id'], $item['guid']);
                if (empty($id)) {
                    $id = $splitfeedurl[0].":".$item['date_timestamp'];
                }

                $entry['title'] = $item['title'];
                $entry['introduction'] =  getDefault($item['description'], getDefault($item['atom_content'], $rss->channel['summary']));

                $entry['extrafields']['feedgrabber_link'] =  $item['link'];
                $entry['extrafields']['feedgrabber_id'] =  $id;
                $entry['extrafields']['feedgrabber_author'] =  getDefault($item['author'], $rss->channel['managingeditor']);
                $entry['extrafields']['feedgrabber_source'] =  $rss->channel['title'];

                $entry['category'] = $splitfeedurl[1];
                $entry['user'] = $feedgrabber_config['user'];
                $entry['status'] = $feedgrabber_config['status'];
                $entry['allow_comments'] = $feedgrabber_config['allow_comments'];
                $entry['date'] = date("Y-m-d H:i:s", $item['date_timestamp']);

                $entry['extrafields']['feedgrabber_checksum'] = md5(serialize($entry));


The Above Imports, but imports in the "(none)" Category.

What i think is going on is the import of all feeds, then it inserts them in the database loosing the
Code: Select all
$entry['category'] = $splitfeedurl[1];

name of the category.

Any Suggestions?
Regards,
-Jeff Zakovec
jz1977
 
Posts: 9
Joined: Wed Oct 26, 2011 5:47 am

Re: Feedgrabber extension

Postby hansfn » Fri Nov 04, 2011 9:14 am

jz1977, what you are trying to do - per feed settings - is easy to do. I just don't have time now - maybe early next week. Your approach is too hacky to my liking ;-)
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Feedgrabber extension

Postby robertyyz » Wed Apr 11, 2012 4:11 pm

Was this resolved? I too am wondering how to direct a feed grab to the proper category.

What is the proper way to manage this?

Thanks!
robertyyz
 
Posts: 2
Joined: Wed Apr 11, 2012 4:08 pm

Re: Feedgrabber extension

Postby robertyyz » Wed Apr 11, 2012 4:26 pm

OK, got it. Just add the appropriate user and category in the feed grabber_config.php script.
robertyyz
 
Posts: 2
Joined: Wed Apr 11, 2012 4:08 pm

Previous

Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 9 guests

cron