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.