Log in |
This is the README file for RDFSummary 2.x. If you have installed version 1.x, then read this file. RDFSummary is a product to display content from other web sites provided they make it available in RSS 0.9, 0.91, 0.92 or RSS 1.0 format. The benefit of doing it this way is that the data you get is not encumbered with HTML, giving you more flexibility when applying your own look and feel. How to use itFirst you install RDFSummary.tgz in the Products folder and restart Zope. You will now be able to create objects of the type "RDF Summary". The form will ask you four questions: the id, title, URL of the RSS File and an optional proxy server. This product understands versions 0.9, 0.91, 0.92 and 1.0 of the RSS format. You enter the URL that will return a correct format. If your RDF file is password protected you can specify authentication parameters like this: http://user:[email protected]/file.rdf If nothing comes to mind, you can always try http://www.slashdot.org/slashdot.rdf. Last time I checked it was version 0.9. Otherwise, I have created some test files on Zope.org.
There is also an optional property for a proxy-server. You enter the URL of the proxy as in http://proxy.mycompany.com:8080. Authenticated proxies are supported if you are using Python 2.1. To use an authenticated proxy, you enter the URL as in http://user:[email protected]:8080. When you have created the object, you must update or synchronize the object with the content on the remote webserver. Click Update to perform it. Most common mistake is bad encoding of the file in which case you get a syntax error or you have HTML tags somewhere in the title or description and these are not supported. Let's say you have created a channel called slashdot. Then insert this in your dtml-document <dtml-with slashdot> <dtml-var "channel()['title']"> <dtml-var picture> <dtml-in items mapping> <p> <a href="<dtml-var link>"> <dtml-var title></a><br> <dtml-if "_.has_key('description')"> <dtml-var description> </dtml-if> </p> </dtml-in> </dtml-with>or if you prefer ZPT: <metal:block tal:condition="here/slashdot" tal:define="news here/slashdot" > <div tal:content="python:news.channel()['title']" /> <div tal:repeat="item news/items"> <a href="" tal:attributes="href item/link" tal:content="item/title" /> </div> <div> <a href="" tal:attributes="href python:news.channel()['link']">More ...</a> </div> </metal:block> If you want your Site Summary to import data on a regular basis, you can write a program which updates the channel by doing a GET on the update method as in: lynx -source http://www.mysite.com/slashdot/update >/dev/nullGenerally, it's polite to ask the owner of the RSS file if you can use their file, and also not to retrieve it more than once per hour. The ImageThe image can be referenced in two ways: <dtml-if "image().has_key('data')"> <img src="&dtml-absolute_url;/view_image"> </dtml-if> or <dtml-var picture>The last convenience method will also put an anchor-tag around the img-tag if the RSS file contains a link for the image. TextinputThe textinput could be used like this: <dtml-with slashdot> <form method="GET" action="<dtml-var "textinput()['link']">"> <dtml-var "textinput()['description']"><br> <dtml-var "textinput()['title']"> <input type="text" name="<dtml-var "textinput()['name']">"> </form> </dtml-with> How it worksAn RDF Site Summary file consists of four main parts. A channel part, (inside <channel> tags), which is the description of the summary file itself. An optional image part, which contains a url to an image file of about 88x31 pixels. An optional textinput part. It contains the elements necessary to set up a search for the site you are retrieving the summary from. Finally there is the items-part. The first three are implemented as Python dictionaries called channel, image and textinput. The last one is implemented as an array of dictionaries. A Python dictionary is also known as an associative array. It is kind of like a sack, where you can put all your goodies tagged with a keyword you can use to get them back. RDFSummary parses the summary file, and for each tag inside the four main parts, it stores them under a keyword. Since there is only a few mandatory tags, you must typically first check if the dictionary contains the item before you can use it. RDFSummary supports the core RDF Site Summary 1.0, and the two modules: Syndication and Dublin Core. How it supports them is very simple. It simply maps the namespaces to easily usable keywords. The Dublin Core has one tag for dates, but RDFSummary doesn?t try to understand the date. It just treats it as a string. Restrictions & peculiarities
Experimental support for eventsWith version 1.4 I've add experimental support for the event RSS module, which I have authored myself and proposed to the RSS-DEV working group. The event module will make it possible for you to grab events like meetings, conferences etc. from remote websites and create a calendar listed in the order of the event time. How does it work? Assume you grab event announcements from three different sources: KDE, Usenix and O'Reilly and save them to the objects; kde, usenix and oreilly. Then you can make a simple calendar like this: <dtml-var standard_html_header> <h2>Calendar of events</h2> <dtml-comment> Make one big list from three sources </dtml-comment> <dtml-call "REQUEST.set('evlist',[])"> <dtml-in "(kde,usenix,oreilly)"> <dtml-in items> <dtml-call "evlist.append(_['sequence-item'])"> </dtml-in> </dtml-in> <dtml-comment> Go through the list sorted on startdate. Event adds the elements startdate, enddate, location, organizer and type. </dtml-comment> <dtml-in evlist mapping sort=startdate> <p> <a href="<dtml-var link>"><dtml-var title></a><br> <dtml-var startdate> <dtml-if "_.has_key('enddate')"> - <dtml-var enddate> </dtml-if> <dtml-if "_.has_key('location')"> <br><dtml-var location> </dtml-if> </p> </dtml-in> <dtml-var standard_html_footer> AcknowledgementsThis product would probably never have seen the daylight if I hadn't been able to build on top of Edd Dumbill's SiteSummary product. |