Monday, November 08, 2010 at 12:05 AM.

on publishStaticArchivePages (adrblog=radio.weblog.init (), minDate=nil, maxDate=nil) {
	<<Publish all archive pages for a weblog. Return the number of days published.
		<<9/3/01; 5:49:20 PM by JES
			<<Cribbed from radio.weblog.publishArchivePages.
		<<9/18/01; 11:17:27 PM by JES
			<<Added two optional parameters: minDate and maxDate, used for rendering all archive pages for a given time-span.
	local (adrPosts = @adrblog^.posts);
	local (adrPost);
	local (lastDay, lastMonth, lastYear);
	local (ctDays = 0);
	if minDate == nil {
		minDate = date (0)};
	if maxDate == nil {
		maxDate = date.set (1, 1, 2040, 0, 0, 0)};
	for adrPost in adrPosts {
		if adrPost^.when < minDate {
		if adrPost^.when > maxDate {
		local (day, month, year, hour, minute, second);
		date.get (adrPost^.when, @day, @month, @year, @hour, @minute, @second);
		if day == lastDay and month == lastMonth and year == lastYear { //same as previous day, continue
		local (minDateForPage = date.set (day, month, year, 0, 0, 0));
		local (maxDateForPage = date.set (day, month, year, 23, 59, 59));
		radio.weblog.publishStaticPage (adrblog, maxDays:1, maxDate:maxDateForPage, minDate:minDateForPage, flHomePage:false); //publish this day
		lastDay = day;
		lastMonth = month;
		lastYear = year};
	return (ctDays)}
<<bundle //test code
	<<radio.weblog.publishStaticArchivePages ()

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.