RSS Import Handler: need information

Author Message

Andrey Astakhov

Tuesday 07 October 2008 9:55:10 am

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?

Łukasz Serwatka

Tuesday 07 October 2008 1: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.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Andrey Astakhov

Wednesday 08 October 2008 3:11:23 am

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?

Łukasz Serwatka

Wednesday 08 October 2008 4:09:19 am

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.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:11:17
Script start
Timing: Jan 18 2025 16:11:17
Module start 'layout'
Timing: Jan 18 2025 16:11:17
Module start 'content'
Timing: Jan 18 2025 16:11:17
Module end 'content'
Timing: Jan 18 2025 16:11:17
Script end

Main resources:

Total runtime0.0136 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.3672152.6250
Module start 'layout' 0.00510.0026 741.992239.4453
Module start 'content' 0.00770.0040 781.437593.3672
Module end 'content' 0.01170.0019 874.804738.3047
Script end 0.0136  913.1094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002317.0698140.0002
Check MTime0.00118.2078140.0001
Mysql Total
Database connection0.00107.497810.0010
Mysqli_queries0.002316.842430.0008
Looping result0.00000.080510.0000
Template Total0.001611.810.0016
Template load0.00096.506110.0009
Template processing0.00075.280110.0007
Override
Cache load0.00053.858210.0005
General
dbfile0.00021.458680.0000
String conversion0.00000.043740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs