RSS Feeds into eZ

In this particular case I am making a feed using google, plug the search terms into the url.

http://news.google.com/news?hl=en&ned=us&q=fishing+%2B+walleye+%2B+MO&ie=UTF-8&output=rss

This above when entered as a single line in a feed reader, creates a google news feed based upon the search “fishing + walleye + MO”. The three pieces of text surrounding the + signs in other words.

Plugging that feed into this excellent  article by Paul Wilson , eZ quickly provides something that looks like this:

rss feed

rss feed

But clicking any of these links to read the full article, the raw html formatting is included as per below.  Ugleee.

default rss description

default rss description

In Admin interface, set debug to show templates, and find that the template that is responsible for outputting this content is design/standard/templates/content/datatype/view/eztext.tpl.

In other words, eztext.tpl is the template that must be overridden to change the displayed output.  Lots of documentation and discussion about overrides and ini files and all kinds of confusing stuff.  Instead of reading all that, while logged in to the user interface, with template debug turned on, notice at the very bottom of the page, a list of templates, and an icon to click that will start the override process.

templates with override button

templates with override button

Easiest to make a copy of the current template to use as the basis for the override, call it ezrsstext.tpl.  Magically, this copy appears in an edit window.

edit ezrsstext.tpl

edit ezrsstext.tpl

Somewhere the first time through the docs, I seem to remember that “wash” did to something to clean up the html formatting.  So I took “wash” out along with the (xhtml) which I assumed was a parameter being passed to wash.  If dealing with user input, bypassing wash likely would cause security considerations.  The entire contents of ezrsstext.tpl is {$attribute.content|nl2br}.  And it actually works.  Had it not, it was just an override used in this one new place on the site, the rest of the site is not affected.  Instead of pulling the full .content, it is possible to just pull the .link, or the .description attributes from the feed depending upon what looks best in the display. Gotta love object oriented code.  The full .content displays like this–

Rss-details

Rss-details

Reviewing the Content Structure, in admin, the feeds are dumped into folders, that feed frontpage items, like this –

Admin - Content Structure

Admin - Content Structure

Testing locally on my mac, I had to turn off the firewall for the feeds to download.  With the firewall on, I did not get any error messages or any feeds downloaded.  With the firewall temporarily off, switching into the folder where ezpublish is located and running runcronjobs.php from the command line gives a nice running report of feeds as they are downloaded.

sh-3.2# pwd

/Library/WebServer/Documents/pub401

sh-3.2# php runcronjobs.php

runcronjobs

runcronjobs

Tags: , ,

Filed under:eZ Flow, ez.no

Comments are closed.