@USE
FeedRss.p
@main[]
# create Feed object and set channel's fields in place.
# you can specify any channel's field which described in RSS 2 specification.
$oFeed[^FeedRss::create[
$.title[RSS title]
$.link[http://$env:SERVER_NAME/]
$.description[RSS description]
# default docs value
# $.docs[http://blogs.law.harvard.edu/tech/rss]
# default generator value
# $.generator[^if(def $env:PARSER_VERSION){$env:PARSER_VERSION}{Parser 3}]
# $.copyright[Copyright (c) Vasya Poupkin]
# $.webMaster[vasya@poupkin.ru]
# $.ttl(10)
# $.image[
#
Short image description
# http://$env:SERVER_NAME/link/to/image.jpg
# http://$env:SERVER_NAME/
# 100
# 100
# ]
# and so on
]]
# redefine some channel's fields if needed
^oFeed.set[
$.title[RSS title ^[updated^]]
]
# add items
# you can specify any item's field which described in RSS 2 specification.
# you can specify date fields as date objects or as a strings with date in sql format.
^oFeed.addItem[
$.title[Item 1 title]
$.guid[http://item1-link]
$.pubDate[^date::create[2007-08-02 22:33:44]]
$.author[^taint[Name ]]
]
^oFeed.addItem[
$.title[Item 2 title]
$.guid[http://item2-link]
$.pubDate[2007-08-01 12:23:34]
$.description[Item 2 description]
$.comments[Item 2 comments]
]
# print Feed's xml.
# before printing the required fields will be checked.
# by default all necessary HTTP headers will be set (last-modified, content-type)
^oFeed.print[
$.sVersion[2.0]
# you must specify which timezone will be used while printing date fields.
# as described in RFC822 you can use with safety GMT, UTC, some USA timezones or time offset.
# in case if timezone which was specified not equal to server timezone
# you must manually roll all channel's and item's date fields during definition.
$.sTZ[+0300]
# $.sTZ[GMT]
# the number of items which will be printed. by default all items will be printed.
$.iItemLimit(10)
# order items by pubDate field. by default items will be printed in order as they were added.
$.bOrderItems(true)
# suppress XML declaration.
# $.bOmitXMLDeclaration(true)
# suppress HTTP headers.
# $.bOmitHTTPHeaders(true)
]
#end @main[]