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

on getUrlForDay (d, catname="", adrdata=radio.weblog.init ()) {
		<<8/28/02; 6:13:36 PM by LL
			<<Created. Returns the URL of a daily archive page, given the date and optionally the category.
	local (folder);
	if catname == "" { //get the weblog archive relative folder path
		local (homeRelPath = adrdata^.prefs.homePageFilePath);
		local (homeFileName = string.nthField (homeRelPath, "/", string.countFields (homeRelPath, "/")));
		local (relFolder = string.mid (homeRelPath, 1, sizeOf (homeRelPath) - sizeOf (homeFileName)));
		folder = radio.file.getAbsolutePath (relFolder)}
	else { //get the category archive relative folder path
		local (adrcat = @adrdata^.categories.[catname]);
		folder = radio.weblog.file.getCategoryFolder (catname, adrdata)};
	local (f = radio.weblog.file.getArchiveFilePath (folder, d, false) );
	local (pageurl = "");
	local (adrfile =[f]);
	if defined (adrfile^) {
		if adrfile^.upstream.url != "" {
			pageurl = adrfile^.upstream.url}};
	if pageurl == "" { //get upstreamed file extension
		local (extension = ".html");
		local (atts, directives); new (tableType, @directives);
		radio.webserver.gatherAttributes (f, @atts, @directives);
		if defined (directives.renderedFileExtension) {
			extension = directives.renderedFileExtension};
		if not (extension beginsWith ".") { //ensure leading '.'
			extension = "." + extension};
		f = string.popSuffix (f) + extension;
		pageurl = radio.upstream.getFileUrl (f);
		if defined (adrfile^) { //cache the url
			adrfile^.upstream.url = pageurl}};
	return (pageurl)}

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.