I'm a big fan of RSS and I think that it's something that people running extranets and other sites should try to incorporate as much as possible.
Recently I decided to try and add RSS to a Domino Database manually.
The steps are below.
I've simplified them to make this more suitable for "beginners", and you can add other RSS Fields as you see fit.
PART 1: The VIEW
Create a view for your database with a selection criteria similar to the following;
SevenDaysAgo := @Adjust(@Now ;0 ; 0 ; -7 ; 0 ; 0 ; 0) ;
SELECT ((Form = "Document")& @Modified <= SevenDaysAgo))
The Form would obviously point to the type of form that you use in your database.
Column 1: The first Column in your database would probably be the date (@Modified) You should make it sorted in Descending order to put the recent items to the top and you should make it hidden.
Column 2:
Here is what I have in column 2 - I'll explain it below...
NOTE: I can't use <> HTML Codes Here, so I've replaced the brackets with braces {} You should substitute these on your code. I've also had to put a second M in the word amp. Remove this when using the code.
SV:=@DbLookup( "":"NoCache" ; "":"" ; "KRetrieval" ; "WebLocation" ; 2);
DB:= @Implode(@Explode(@Text(@Subset(@DbName;-1)); "\\");"/");
NDXDocNumber:= DocumentUniqueName;
DocNumLink:= "http://"+ SV +"/" + DB+"/NDX/"+NDXDocNumber+"?OpenDocument&Login" ;
"{item}" + "{title}" + TXTDocNumber + "{/title}" + "{link}" +
@ReplaceSubstring(DocNumLink; "&"; "&ammp;")
+ "{/link}{description}"
+ TXTTitle + "(" + KEYAuthor + ")" + "{/description}" + "{guid}"+
NDXDocNumber
+"{/guid}{/item}"
I have lookups all the way through my databases, so the first line simply does a lookup for my weblocation and stores it in SV. I could have used...
SV := "www.myserversite.com";
The second line, is a standard database name determination function with replacesubstrings to convert DOS/Windows backslashes into Web Forward Slashes and store the result in DB.
I could have used the following, but it would have been hardcoding.
DB := "myfolder/mydatabase.nsf";
The NDXDocNumber bit retreives a unique ID, used to access my documents in a view (you could use Notes UNIDs if you prefer).
The DocNumLink bit is where I actually build the URL to my document. Again, I use short URLs, but you could use UNIDs if you prefer.
The remaining bits are the ITEM Tags each of which ultimately looks a bit like the following...
TXTDocNumber, DocNumLink, TXTTitle, KEYAuthor and NDXDocNumber are database fields which you may want to replace with your own.
The ReplaceSubstring bit replaces any ampersands (&) with &ammp; which is more RSS friendly. Note that I can't even write the amp word without interpretation, so remove the second m
In the advanced properties for the View, tick the box marked
[x] Treat View contents as HTML
Once you've completed the view, it's time to move onto a form.
PART 2: The FORM
Assuming that the view was called RSS, we now need a form
$$ViewTemplate for RSS
Just a reminder: I can't use <> HTML Code here, so I've replaced the brackets with braces {} You should substitute these on your code.
The form should contain the following text...
{?xml version="1.0"?}
{rss version="2.0"}
{channel}
{title}My RSS Feed Title{/title}
{link}http://www.myserversite.com/{/link}
{description}This is a cool feed{/description}
{language}en-us{/language}
{generator}IBM Lotus Domino{/generator}
{webMaster}support@myserversite.com{/webMaster}
******$$VIEWBODY FIELD***************
{/channel}
{/rss}
Obviously you will want to change some of the descriptions etc above, and probably put the DB Title in there (or some other computed field).
The line with the stars in it is really just the $$VIEWBODY field.
(ie: Just a text field called $$VIEWBODY)
You should go into the advanced tab of form properties and set the content type to OTHER.
In the text box next to Other, put text/xml
Save the form.
You should now be able to display an RSS Feed using
http://www.myserversite/myfolder/mydatabase/RSS
Note that some feed readers dont support Authentication and some don't support HTTPS.
If in doubt, try an unsecured database first.
Good luck.
Recently I decided to try and add RSS to a Domino Database manually.
The steps are below.
I've simplified them to make this more suitable for "beginners", and you can add other RSS Fields as you see fit.
PART 1: The VIEW
Create a view for your database with a selection criteria similar to the following;
SevenDaysAgo := @Adjust(@Now ;0 ; 0 ; -7 ; 0 ; 0 ; 0) ;
SELECT ((Form = "Document")& @Modified <= SevenDaysAgo))
The Form would obviously point to the type of form that you use in your database.
Column 1: The first Column in your database would probably be the date (@Modified) You should make it sorted in Descending order to put the recent items to the top and you should make it hidden.
Column 2:
Here is what I have in column 2 - I'll explain it below...
NOTE: I can't use <> HTML Codes Here, so I've replaced the brackets with braces {} You should substitute these on your code. I've also had to put a second M in the word amp. Remove this when using the code.
SV:=@DbLookup( "":"NoCache" ; "":"" ; "KRetrieval" ; "WebLocation" ; 2);
DB:= @Implode(@Explode(@Text(@Subset(@DbName;-1)); "\\");"/");
NDXDocNumber:= DocumentUniqueName;
DocNumLink:= "http://"+ SV +"/" + DB+"/NDX/"+NDXDocNumber+"?OpenDocument&Login" ;
"{item}" + "{title}" + TXTDocNumber + "{/title}" + "{link}" +
@ReplaceSubstring(DocNumLink; "&"; "&ammp;")
+ "{/link}{description}"
+ TXTTitle + "(" + KEYAuthor + ")" + "{/description}" + "{guid}"+
NDXDocNumber
+"{/guid}{/item}"
I have lookups all the way through my databases, so the first line simply does a lookup for my weblocation and stores it in SV. I could have used...
SV := "www.myserversite.com";
The second line, is a standard database name determination function with replacesubstrings to convert DOS/Windows backslashes into Web Forward Slashes and store the result in DB.
I could have used the following, but it would have been hardcoding.
DB := "myfolder/mydatabase.nsf";
The NDXDocNumber bit retreives a unique ID, used to access my documents in a view (you could use Notes UNIDs if you prefer).
The DocNumLink bit is where I actually build the URL to my document. Again, I use short URLs, but you could use UNIDs if you prefer.
The remaining bits are the ITEM Tags each of which ultimately looks a bit like the following...
TXTDocNumber, DocNumLink, TXTTitle, KEYAuthor and NDXDocNumber are database fields which you may want to replace with your own.
The ReplaceSubstring bit replaces any ampersands (&) with &ammp; which is more RSS friendly. Note that I can't even write the amp word without interpretation, so remove the second m
In the advanced properties for the View, tick the box marked
[x] Treat View contents as HTML
Once you've completed the view, it's time to move onto a form.
PART 2: The FORM
Assuming that the view was called RSS, we now need a form
$$ViewTemplate for RSS
Just a reminder: I can't use <> HTML Code here, so I've replaced the brackets with braces {} You should substitute these on your code.
The form should contain the following text...
{?xml version="1.0"?}
{rss version="2.0"}
{channel}
{title}My RSS Feed Title{/title}
{link}http://www.myserversite.com/{/link}
{description}This is a cool feed{/description}
{language}en-us{/language}
{generator}IBM Lotus Domino{/generator}
{webMaster}support@myserversite.com{/webMaster}
******$$VIEWBODY FIELD***************
{/channel}
{/rss}
Obviously you will want to change some of the descriptions etc above, and probably put the DB Title in there (or some other computed field).
The line with the stars in it is really just the $$VIEWBODY field.
(ie: Just a text field called $$VIEWBODY)
You should go into the advanced tab of form properties and set the content type to OTHER.
In the text box next to Other, put text/xml
Save the form.
You should now be able to display an RSS Feed using
http://www.myserversite/myfolder/mydatabase/RSS
Note that some feed readers dont support Authentication and some don't support HTTPS.
If in doubt, try an unsecured database first.
Good luck.
Comments
1. The use of @dblookup in the 2nd column looks challenging - I never succeeded in making it work in a column, and Domino Designer Help says about @dblookup:
Usage
This function does not work in column or selection formulas, or in mail agents.
2. I understand that the form provides the overall 'rss' and 'channel' tructure to the rss-feed, but not sure where does the text go, where and how is the view being included.
3. What does the rss reader have to point to, eventually, the view or the form?
Thanks! - Amnon