@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[Новости Свято-Крестовского (Буденновского) благочиния] $.link[http://$env:SERVER_NAME/] $.description[http://www.sv-krest.ru] # 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. ^connect[$connect_string]{ $NewsAll[^table::sql{SELECT ID, Date, Head, Anons, News, Moderated, Type FROM News ORDER BY `OrderDate` DESC LIMIT 30}] $NewsList[ ^News_type.foreach[key;value]{ $.[$key][^table::sql{SELECT ID, Date, Head, Anons, News, Moderated, Type FROM News WHERE Moderated = 1 and Type = '$key' AND (TO_DAYS(NOW()) - TO_DAYS(Date) <= 60) ORDER BY `OrderDate` DESC LIMIT 8}] } ] } ^if(def $NewsAll){ $table[^table::create[$NewsAll]] ^table.menu{ $ann[$table.Anons] ^oFeed.addItem[ $.title[^untaint{^table.Head.replace[$antixml]}] $.guid[http://www.sv-krest.ru/news/index.html?Type=$table.Type&^;ID=$table.ID] $.pubDate[$table.Date] $.description[^ann.match[][g]{}] $.author[^taint[http://www.sv-krest.ru]] ] } } # #^untaint{^table.Head.replace[$antixml]} #^untaint{^table.Anons.replace[$antixml]} # # 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(30) # 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[]