[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:

Re:Still More on EudoraPro Email (1998) [ShowCart] and GET vs. POST (1997) Can't find templaes (1997) Adding a product from another site (1997) [OT] Friday Time Waster (2003) [taxRate] [TaxTotal] ? (1997) Large Database Issue (possible bug) (2004) Date Sorting (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) WebCat2b12 - nesting [tags] (1997) Big Databases (1997) Location of Browser Info.txt file (1997) Having Webcatalog Print results - Possible Solution (1999) [BULK] [WebDNA] abstraction code can be tricky... (2012) Search and Change (2003) UPS Rates (2006) Requiring that certain fields be completed (1997) 2.0Beta Command Ref (can't find this instruction) (1997) Banners (1997) Roundup function? (1997)