eZ Community » Forums » Developer » RSS Import Handler: need information
expandshrink

RSS Import Handler: need information

RSS Import Handler: need information

Tuesday 07 October 2008 6:55:10 pm - 3 replies

I have to import special rss item tags as object attributes. Unfortunately standard eZ Publish functionality doesn't allow it.

I see such block in site.ini:

#
# Settings for RSS
#
[RSSSettings]
# RSS import handler Extension settings
# Must be placed in <extension directory>/<active extension>/rss/ezrssimporthandler.php
ActiveExtensions[]

Presumably there is a possibility to create own rss import handlers. Does anybody have documentation and/or expirience re this topic?

Tuesday 07 October 2008 10:27:54 pm

Hi,

This is used to create your own RSS field definition array:

Basically you need to create a class which implementing rssFieldDefinition public method

Example extension:

// class name is construct as <active_extension> +  'rssimport'
// 'rssimport' suffix must be part of class name
class MyCustomFieldsrssimport
{
    public function rssFieldDefinition()
    {
        return array( 'item' => array( 'elements' => array( 'title',
                                                                    'link',
                                                                    'description',
                                                                    'author',
                                                                    'category',
                                                                    'comments',
                                                                    'guid',
                                                                    'pubDate' ) ),
                              'channel' => array( 'elements' => array( 'title',
                                                                       'link',
                                                                       'description',
                                                                       'copyright',
                                                                       'managingEditor',
                                                                       'webMaster',
                                                                       'pubDate',
                                                                       'lastBuildDate',
                                                                       'category',
                                                                       'generator',
                                                                       'docs',
                                                                       'cloud',
                                                                       'ttl' ) ) );
    }
}

Put that class in

extension/MyCustomFields/rss/MyCustomFieldsrssimport.php

Then enable it in site.ini.append.php as

[RSSSettings] 
ActiveExtensions[]=MyCustomFields

Clear all the cache and go to admin interface, then check available filed definition in RSS import.

Beware of typos, I did not test it with eZ Publish instance.

Modified on Tuesday 07 October 2008 10:31:10 pm by Ɓukasz Serwatka

Wednesday 08 October 2008 12:11:23 pm

Thank you, Lukasz.

Is rssFieldDefinition a single metod i could implement? Is it posiible to override import process?

E.g could i insert my own parsing of rss items before rssimport script?

Wednesday 08 October 2008 1:09:19 pm

That method has to return array with RSS definition (you can include here your custom RSS tags), which you can map later to the content object attributes in RSS import view IIRC. You can not put in that method your RSS parsing code I'm afraid.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu