Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 124 lines (93 sloc) 3.051 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

RSS FEED INTERFACE
------------------

RSS is very cool! To see it in action look no further than Firebird 1.0.
Then go to an RSS-enabled site, e.g slashdot.org . Note the little orange
icon down in the right corner of the browser window. Click on the icon
and add the RSS-feed to you personal toolbar. Then click on your toolbar,
on the RSS-bookmark and watch the nice menu of slashdot article-summarys
popping up.

The module yaws_rss.erl provides an RSS store/interface so that
you can RSS enable your application. More documentation can be
found in the yaws_rss.erl file (edoc).


TO CREATE AN RSS FEED
--------------------

Make sure your top page has the corresponding link information
in the 'head' part as shown in the example below:

index.html
==========
<html>
<head>
<link rel="alternate"
      title="Example RSS"
      href="//localhost:3080/rss.yaws"
      type="application/rss+xml>
<title>Example</title>
</head>
<body>
Hello world
</body>
</html>
=========

The link info above refers to a file rss.yaws which
could look something like this:

rss.yaws
========
<erl>

out(A) ->
case yaws_rss:retrieve(test, xml) of
{ok, Xml} ->
{content, "text/xml", head()++Xml++tail()};
_ ->
{content, "text/xml", ""}
    end.

head() ->
"<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">
  <channel>
    <title>Exampel RSS feed</title>
    <link>http://www.blaha.org/</link>
    <description>
     Bla bla....
    </description>
    <language>en</language>".

tail() ->
" </channel>
</rss>".

</erl>

========

To insert RSS items into the feed from your application, you
can write code like:

....
yaws_rss:insert(test, xml, "Yaws now support RSS feeds.",
"http://www.blaha.org/latest_news.html",
"Yaws has now been extended to support....",
                    "Bill Smith").
....

First comes the application (RSSid) then a tag (these were used in
rss.yaws when we retrieved the RSS content). Then follows the
Title, Link, Description and Creator.

The idea is that several independent application should be able
to use the yaws_rss.erl API without affecting each other. Also,
one application may have several RSS feeds (hence the Tag).



HOW TO CONFIGURE RSS
--------------------

Inside a <server> block you specify the application you want
to produce RSS content as:

<rss>
  rss_id = <application>
  rss_dir = <database directory>
</rss>

The rss_id corresponds to the 'App' argument above and must be
defined by the application in question. So, for example,
the wiki application is using 'wiki' as rss_id. The rss_dir
setting specifies the directory where the RSS database resides.
Both are mandatory.

Other, non-mandatory, configuration parameters are (with
explanation and default values):

<rss>
  rss_expire = false | days # expire items, or not (false)
  rss_days = <integer> # days until expired
  rss_rm_exp = <bool> # remove expired items (false)
  rss_max = <integer> # max no.of items stored (infinite)
</rss>

Good luck !

Tobbe


Something went wrong with that request. Please try again.