Share » Forums » Setup & design » RSS Import and publish at multiple...

RSS Import and publish at multiple locations

RSS Import and publish at multiple locations

Monday 18 August 2008 6:18:23 am - 3 replies

Author Message

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

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

36 542 Users on board!

Forums menu