Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 124 lines (93 sloc) 3.057 kb
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
1
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
2 RSS FEED INTERFACE
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
3 ------------------
4
5 RSS is very cool! To see it in action look no further than Firebird 1.0.
6 Then go to an RSS-enabled site, e.g slashdot.org . Note the little orange
7 icon down in the right corner of the browser window. Click on the icon
8 and add the RSS-feed to you personal toolbar. Then click on your toolbar,
9 on the RSS-bookmark and watch the nice menu of slashdot article-summarys
10 popping up.
11
12 The module yaws_rss.erl provides an RSS store/interface so that
13 you can RSS enable your application. More documentation can be
14 found in the yaws_rss.erl file (edoc).
15
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
16
17 TO CREATE AN RSS FEED
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
18 --------------------
19
20 Make sure your top page has the corresponding link information
21 in the 'head' part as shown in the example below:
22
23 index.html
24 ==========
25 <html>
26 <head>
27 <link rel="alternate"
28 title="Example RSS"
29 href="//localhost:3080/rss.yaws"
30 type="application/rss+xml>
31 <title>Example</title>
32 </head>
33 <body>
34 Hello world
35 </body>
36 </html>
37 =========
38
39 The link info above refers to a file rss.yaws which
40 could look something like this:
41
42 rss.yaws
43 ========
44 <erl>
45
46 out(A) ->
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
47 case yaws_rss:retrieve(test, xml) of
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
48 {ok, Xml} ->
e1cb0d1 Updated RSS documentation.
Tobbe Tornquist authored
49 {content, "text/xml", head()++Xml++tail()};
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
50 _ ->
e1cb0d1 Updated RSS documentation.
Tobbe Tornquist authored
51 {content, "text/xml", ""}
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
52 end.
53
e1cb0d1 Updated RSS documentation.
Tobbe Tornquist authored
54 head() ->
55 "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">
56 <channel>
57 <title>Exampel RSS feed</title>
58 <link>http://www.blaha.org/</link>
59 <description>
60 Bla bla....
61 </description>
b6717e7 Fixed the RSS date format, as suggested by Daniel Kaminski.
Tobbe Tornquist authored
62 <language>en</language>".
e1cb0d1 Updated RSS documentation.
Tobbe Tornquist authored
63
64 tail() ->
65 " </channel>
66 </rss>".
67
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
68 </erl>
69
70 ========
71
72 To insert RSS items into the feed from your application, you
73 can write code like:
74
75 ....
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
76 yaws_rss:insert(test, xml, "Yaws now support RSS feeds.",
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
77 "http://www.blaha.org/latest_news.html",
78 "Yaws has now been extended to support....",
79 "Bill Smith").
80 ....
81
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
82 First comes the application (RSSid) then a tag (these were used in
83 rss.yaws when we retrieved the RSS content). Then follows the
84 Title, Link, Description and Creator.
85
86 The idea is that several independent application should be able
87 to use the yaws_rss.erl API without affecting each other. Also,
88 one application may have several RSS feeds (hence the Tag).
89
90
91
92 HOW TO CONFIGURE RSS
93 --------------------
94
95 Inside a <server> block you specify the application you want
96 to produce RSS content as:
97
98 <rss>
99 rss_id = <application>
8545c2c @vinoski document rss_dir
vinoski authored
100 rss_dir = <database directory>
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
101 </rss>
102
8545c2c @vinoski document rss_dir
vinoski authored
103 The rss_id corresponds to the 'App' argument above and must be
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
104 defined by the application in question. So, for example,
8545c2c @vinoski document rss_dir
vinoski authored
105 the wiki application is using 'wiki' as rss_id. The rss_dir
106 setting specifies the directory where the RSS database resides.
107 Both are mandatory.
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
108
109 Other, non-mandatory, configuration parameters are (with
110 explanation and default values):
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
111
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
112 <rss>
113 rss_expire = false | days # expire items, or not (false)
fbf6580 Yaws is now RSS capable, see doc/README.rss
Tobbe Tornquist authored
114 rss_days = <integer> # days until expired
30d2427 Added RSS config parameters ro config parser and some more documentat…
Tobbe Tornquist authored
115 rss_rm_exp = <bool> # remove expired items (false)
116 rss_max = <integer> # max no.of items stored (infinite)
117 </rss>
6e45786 Added RSS store/interface.
Tobbe Tornquist authored
118
119 Good luck !
120
121 Tobbe
122
123
Something went wrong with that request. Please try again.