RSS Import and publish at multiple locations

Author Message

Fabio Farnesi

Monday 18 August 2008 6:18:23 am

Hi

I need import an RSS Feed and publish the contents at multiple locations.
I followed this way, but it don't works.

- Created a new class to host my RSS
- Created a Folder to host the RSS imported
- Added a multiple location point publish for my folder
- Runned runcronjobs

The content is imported right and fast, i can see my feed at main publish point but the content is'nt duplicated in the other locations.

I know, that the documentation said that if i've a multiple location publish point for a folder, only the folder will be replicated and not the subitems, but this not resolve my problem.

Any suggestion to have a multiple location point for a folder and his subitems?

Have a great day
Fabio

Ivo Lukac

Monday 18 August 2008 9:02:04 am

Hello Fabio,

Do it the "brute force" way, make more RSS imports :)

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Paul Wilson

Tuesday 19 August 2008 5:53:59 am

Hi Fabio,

Another approach would be to create a custom template that fetches the imported RSS items.

I have not tried this in this particular case, but I expect it would work.

Briefly, this would involve the following steps...

1. creating (say) a folder object to represent a content node where you want to display the RSS items again.
2. Creating an override for that folder object - probably somewhere like:

/settings/siteaccess/(mysiteaccess)/override.ini.append.php

(ref - general overrides: http://ez.no/doc/ez_publish/technical_manual/4_0/templates/the_template_override_system)

probably something like:

[repeat_rss_content_folder_number_1]                
Source=node/view/full.tpl
MatchFile=repeat_rss_content_folder.tpl
Subdir=templates
Match[node]={nodeID of folder created in step 1}

(ref - override format: http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_override_conditions)

If you want more folders/locations, repeat step 1 and step 2, with different details

3. Create the "repeat_rss_content_folder.tpl" template.

Create a new file with a text editor. In this case, I'll assume you're adapting folder.tpl from the ezwebin extension... (ie /extension/ezwebin/design/ezwebin/override/full/folder.tpl). I'm thinking that the thing to do is:

a) replace all "$node" with "$rsssourcenode"
b) insert the following fetch function near the top of the template (assuming the node_id of the folder containing the rss items is 1234).

            {def $rsssourcenode=fetch( 'content', 'node', hash( 'node_id',  1234) }

(ref fetch functions: http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_fetch_functions)

The purpose of these changes is to fetch and display details of the folder containing your RSS items (and its contained RSS items) instead of the actual node of the folder object you've created.

Save the modified folder.tpl file as "repeat_rss_content_folder.tpl" (ie to match the template override created above).

4. Upload the "repeat_rss_content_folder.tpl" file to your eZ installation.
for example, /extension/ezwebin/design/ezwebin/override/repeat_rss_content_folder.tpl

5. Clear your eZ site's cache (ie allow the override changes to take effect).

If all is well, then visiting the full view for the folder should show all of the RSS items you've imported (or the contents of the node you specified at least).

I expect the same process would apply if you wanted to use an embed view instead of a full one, except the "Source=..." line of the override.ini.append.php entry would change accordingly.

I hope this helps. Regards.

- Paul

Paul Wilson

Tuesday 19 August 2008 4:22:45 pm

Hi Fabio,

There's a really simple way to do what you're asking ... I'd assumed it was not working for you or not appropriate for your needs. Seeing that you're a new-ish member of the eZ Community, I thought I'd better just check that you're aware of it...

Content from one area of an eZ Publish site can be replicated in another by "inserting an object" in an XML text field.

For example, in your case, embedding a link to the eZ object containing your RSS items in (say) your site's homepage.

This involves:

1) Editing the object that you want to include the RSS items in (eg a folder/frontpage ... this will work for any object that contains an XML text field).

2) In the XML text field for that object (eg Folder / Description), click on the paper clip button of the online editor to "insert an object". Then "browse" for (and select) the folder/object containing your imported RSS items. You can then select the view and class to use when displaying the object. (For a basic view of most recent items, I'd select, "embed" view, "itemized sub items" class, and perhaps a limit of 8 subitems (the most recent ones).

3) Send for publishing.

If you need to add the RSS items elsewhere in your site, just repeat this process.

- Paul

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 10:40:19
Script start
Timing: Jan 18 2025 10:40:19
Module start 'layout'
Timing: Jan 18 2025 10:40:19
Module start 'content'
Timing: Jan 18 2025 10:40:20
Module end 'content'
Timing: Jan 18 2025 10:40:20
Script end

Main resources:

Total runtime0.9984 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0085 588.0469152.6406
Module start 'layout' 0.00850.0043 740.687539.4766
Module start 'content' 0.01290.9841 780.1641610.7578
Module end 'content' 0.99700.0014 1,390.921916.1250
Script end 0.9984  1,407.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3456160.0002
Check MTime0.00150.1456160.0001
Mysql Total
Database connection0.00140.145110.0014
Mysqli_queries0.912691.4061620.0147
Looping result0.00060.0634600.0000
Template Total0.951995.320.4760
Template load0.00190.192520.0010
Template processing0.950095.149920.4750
Template load and register function0.00030.026210.0003
states
state_id_array0.00100.096610.0010
state_identifier_array0.00160.158320.0008
Override
Cache load0.00170.1717600.0000
Sytem overhead
Fetch class attribute can translate value0.00070.068230.0002
Fetch class attribute name0.00190.192960.0003
XML
Image XML parsing0.00130.130030.0004
class_abstraction
Instantiating content class attribute0.00000.001970.0000
General
dbfile0.00090.0942230.0000
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs