Forums / Setup & design / RSS Import and publish at multiple locations

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

eZ debug

Timing: Jan 30 2025 00:45:13
Script start
Timing: Jan 30 2025 00:45:13
Module start 'content'
Timing: Jan 30 2025 00:45:13
Module end 'content'
Timing: Jan 30 2025 00:45:13
Script end

Main resources:

Total runtime0.1555 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 588.0625180.8125
Module start 'content' 0.00590.0057 768.875098.0547
Module end 'content' 0.01160.1438 866.9297531.1250
Script end 0.1555  1,398.0547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00382.4537200.0002
Check MTime0.00150.9688200.0001
Mysql Total
Database connection0.00070.443010.0007
Mysqli_queries0.109970.62961410.0008
Looping result0.00150.93801390.0000
Template Total0.143492.210.1434
Template load0.00070.464210.0007
Template processing0.142791.733710.1427
Override
Cache load0.00050.323310.0005
Sytem overhead
Fetch class attribute can translate value0.00050.306110.0005
XML
Image XML parsing0.00020.140110.0002
General
dbfile0.00694.4290200.0003
String conversion0.00000.004030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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