REBOL [ title: "CGI Event Calendar" date: 18-Apr-2010 file: %cgi-event-calendar.r author: Nick Antonaccio purpose: { A web site CGI application that displays events in the current calendar month, with links to specified event pages. Events are stored in the file %bb.db, in the format: ["event 1" 18-Apr-2010 http://website.com/event1.html] ["event 2" 20-Apr-2010 http://website.com/event2.html] ["event 3" 20-Apr-2010 http://website.com/event3.html] This script uses code derived from Bohdan Lechnowsky's "HTML calendar". Taken from the tutorial at http://re-bol.com } ] #! /home/path/public_html/rebol/rebol -cs REBOL [] print "content-type: text/html^/" print {
} pick system/locale/months date/month { } date/year { | ||||||
} day { | } ] ] append html {||||||
}] while [sdate/day: sdate/day + 1 sdate/month = date/month][ event-labels: {} foreach entry bbs [ date-in-entry: 1-Jan-1001 attempt [date-in-entry: (to-date entry/2)] if (date-in-entry = sdate) [ event-labels: rejoin [ {} event-labels " | } sdate/day event-labels { | } ] if sdate/weekday = 6 [append html {|||||
}]] append html { |