[WebDNA] RSS 2.0 Generator Code

This WebDNA talk-list message is from

2008


It keeps the original formatting.
numero = 101700
interpreted = N
texte = RSS is supremely useful! If anyone needs to create feeds from the content on their site, you can syndicate via many sources - create email signatures that change automatically with your site content (feedburner.com), social media widgets that broadcast updates (sproutbuilder.com), daily emails to members with what's new (feedburner.com), and lots of other useful things. Here is a script to create a RSS 2.0 compliant document by just feeding it a table of things you want to put in the feed. Laters, Olin === [table name=data&fields=guid,thisdate,thistime,title,description,link][/table][func tion name=seeddata] -------------------------------------------------------- Start Instructions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ First, in the function "CREATE" edit the static RSS TITLE, DESCRIPTION, LINK, and LANGUAGE elements. Also set the encoding if different than UTF-8. Second, in THIS FUNCTION, create one record in the table "DATA" for every entry in your RSS feed. The GUID field is a unique id for each RSS entry. If your URLS are always unique for each entry, you can set the GUID to the URL. Third, if your dates are not text sortable (yyyy-mm-dd) then you need to adjust the search command in the create function with the following field:  &thisdatetype=date Forth, set your time offset in the pubDate element. You RSS 2.0 compliant document will be created when this script is run. Also easy to tie this script to a write file/trigger to render RSS when needed. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ End Instructions - seed your data in the table below! -------------------------------------------------------- examples of how to append data table...change with your data [append table=data]guid=1&thisdate=2008-12-01&thistime=10:10:01&title=[url]New Item Added: Blue Tie[/url]&description=[url]description[/url]&link=http[/append] [append table=data]guid=2&thisdate=2008-12-02&thistime=10:10:01&title=[url]New Item Added: Green Tie[/url]&description=[url]description[/url]&link=http[/append]  [return][create][/return] [/function][function name=formatdate] [if "[platform]"^"Linux"] [then] [return][linuxfix thisdate=[thisdate]], [/return] [return][Format Days_To_Date %d %b %Y][math]{[thisdate]}[/math][/Format][/return] [/then] [else] [return][Format Days_To_Date %a, %d %b %Y][math]{[thisdate]}[/math][/Format][/return] [/else] [/if] [/function][function name=linuxfix] [math]month=[Format Days_To_Date %m][math]{[thisdate]}[/math][/Format][/math] [math]year=[Format Days_To_Date %Y][math]{[thisdate]}[/math][/Format][/math] [math]day=[Format Days_To_Date %d][math]{[thisdate]}[/math][/Format][/math] [showif [month]<3] [math]month=month+12[/math] [math]year=year-1[/math] [/showif] [switch value=[math](day+(2*month)+floor(6*(month + 1)/10)+year+floor(year/4)-floor(year/100)+floor(year/400)+1)%7[/math]] [case value=0]  [return]Sun[/return] [/case] [case value=1] [return]Mon[/return] [/case] [case value=2]  [return]Tue[/return] [/case] [case value=3]  [return]Wed[/return] [/case] [case value=4]  [return]Thu[/return] [/case] [case value=5]  [return]Fri[/return] [/case] [case value=6]  [return]Sat[/return] [/case] [/switch] [return][/return] [/function][function name=create] Your feed title Feed description http://yoururl/ en-us[search table=data&neguiddatarq=zx&thisdatesort=1&thisdatesdir=de&thistimesort=2&thi stimesdir=de&max=1][foundItems] [formatdate thisdate=[thisdate]] [thistime] -0800[/foundItems][/search] [search table=data&neguiddatarq=zx&thisdatesort=1&thisdatesdir=de&thistimesort=2&thi stimesdir=de][foundItems] <![CDATA[[title]]]> [unurl][link][/unurl] [guid] [formatdate thisdate=[thisdate]] [thistime] -0800 [/foundItems][/search] [/function][seeddata] Associated Messages, from the most recent to the oldest:

    
  1. [WebDNA] RSS 2.0 Generator Code ("Olin Lagon" 2008)
RSS is supremely useful! If anyone needs to create feeds from the content on their site, you can syndicate via many sources - create email signatures that change automatically with your site content (feedburner.com), social media widgets that broadcast updates (sproutbuilder.com), daily emails to members with what's new (feedburner.com), and lots of other useful things. Here is a script to create a RSS 2.0 compliant document by just feeding it a table of things you want to put in the feed. Laters, Olin === [table name=data&fields=guid,thisdate,thistime,title,description,link][/table][func tion name=seeddata] -------------------------------------------------------- Start Instructions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ First, in the function "CREATE" edit the static RSS TITLE, DESCRIPTION, LINK, and LANGUAGE elements. Also set the encoding if different than UTF-8. Second, in THIS FUNCTION, create one record in the table "DATA" for every entry in your RSS feed. The GUID field is a unique id for each RSS entry. If your URLS are always unique for each entry, you can set the GUID to the URL. Third, if your dates are not text sortable (yyyy-mm-dd) then you need to adjust the search command in the create function with the following field:  &thisdatetype=date Forth, set your time offset in the pubDate element. You RSS 2.0 compliant document will be created when this script is run. Also easy to tie this script to a write file/trigger to render RSS when needed. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ End Instructions - seed your data in the table below! -------------------------------------------------------- examples of how to append data table...change with your data [append table=data]guid=1&thisdate=2008-12-01&thistime=10:10:01&title=[url]New Item Added: Blue Tie[/url]&description=[url]description[/url]&link=http[/append] [append table=data]guid=2&thisdate=2008-12-02&thistime=10:10:01&title=[url]New Item Added: Green Tie[/url]&description=[url]description[/url]&link=http[/append]  [return][create][/return] [/function][function name=formatdate] [if "[platform]"^"Linux"] [then] [return][linuxfix thisdate=[thisdate]], [/return] [return][Format Days_To_Date %d %b %Y][math]{[thisdate]}[/math][/Format][/return] [/then] [else] [return][Format Days_To_Date %a, %d %b %Y][math]{[thisdate]}[/math][/Format][/return] [/else] [/if] [/function][function name=linuxfix] [math]month=[Format Days_To_Date %m][math]{[thisdate]}[/math][/Format][/math] [math]year=[Format Days_To_Date %Y][math]{[thisdate]}[/math][/Format][/math] [math]day=[Format Days_To_Date %d][math]{[thisdate]}[/math][/Format][/math] [showif [month]<3] [math]month=month+12[/math] [math]year=year-1[/math] [/showif] [switch value=[math](day+(2*month)+floor(6*(month + 1)/10)+year+floor(year/4)-floor(year/100)+floor(year/400)+1)%7[/math]] [case value=0]  [return]Sun[/return] [/case] [case value=1] [return]Mon[/return] [/case] [case value=2]  [return]Tue[/return] [/case] [case value=3]  [return]Wed[/return] [/case] [case value=4]  [return]Thu[/return] [/case] [case value=5]  [return]Fri[/return] [/case] [case value=6]  [return]Sat[/return] [/case] [/switch] [return][/return] [/function][function name=create] Your feed title Feed description http://yoururl/ en-us[search table=data&neguiddatarq=zx&thisdatesort=1&thisdatesdir=de&thistimesort=2&thi stimesdir=de&max=1][founditems] [formatdate thisdate=[thisdate]] [thistime] -0800[/foundItems][/search] [search table=data&neguiddatarq=zx&thisdatesort=1&thisdatesdir=de&thistimesort=2&thi stimesdir=de][founditems] <![CDATA[[title]]]> [unurl][link][/unurl] [guid] [formatdate thisdate=[thisdate]] [thistime] -0800 [/foundItems][/search] [/function][seeddata] "Olin Lagon"

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WebCat2 as a chat server? (1997) WCS Newbie question (1997) Dynamically Generated Pages & WC? (2000) Nested tags count question (1997) Referrer field to header field conversion (1997) Where is f2? (1997) RE: Multiple Stores and WebCatalog Prefs (1997) Fun with dates (1997) Roundup function? (1997) TCP Connect/send and CGI (2003) Getting Emailer to send mail (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) refreshing IE with posted .tmpl (1997) Location of Webcat site in folder hierarchy (1997) finding child records of child records of child records... with minimal code (2000) [shell] (2002) WebCat2b13MacPlugIn - [include] (1997) [WebDNA] Authorize working connection... (2019) Re:quit command on NT (1997) 404 error -- but wc code executes... (2001)