Tuesday, August 18, 2009 at 7:29 PM.
myTwitterProfileSuite.buildFeedPage
on buildFeedPage (adritem, flWriteHomePage=false) { <<Changes <<5/26/09; 10:27:52 PM by DW <<Build a page that represents one item from a feed, with a place to comment. local (adrfeed = myTwitterProfileSuite.initFeed (adritem^.feed)); if not defined (adritem^.enclosureLength) { myTwitterProfileSuite.getEnclosureData (adritem^.enclosureUrl, @adritem^.enclosureType, @adritem^.enclosureLength)}; myTwitterProfileSuite.getItemTitleDescription (adritem); local (t, level = 0); new (tabletype, @t); t.disqusCode = string (myTwitterProfileSuite.data.disqusThreadCode); table.copycontents (@adrfeed^.params, @t); table.copycontents (adritem, @t); bundle { //convert outlines and wptexts to strings local (adr); for adr in @t { if (typeof (adr^) == wptexttype) or (typeof (adr^) == outlinetype) { local (s = string (adr^)); delete (adr); adr^ = s}}}; t.now = clock.now (); bundle { //set t.username, needed when saving the static file, might as well make it available to template local (adrdata = myTwitterProfileSuite.init ()); t.username = adrdata^.prefs.username}; t.baseUrl = adrfeed^.prefs.baseurl; t.enclosureFname = string.lastfield (t.enclosureurl, "/"); t.enclosureMegabytes = string.megabytestring (t.enclosureLength); t.pubDateString = date.longstring (t.pubdate); t.relpath = file.getdatepath ("/", t.pubdate) + nameof (adritem^) + ".html"; t.pagePath = adritem^.feed + "/" + t.relpath; t.pageUrl = t.baseurl + t.relpath; t.bodytext = ""; t.feedLinks = myTwitterProfileSuite.getFeedLinksHtml (t.feed, t.pubdate); t.feedUrl = t.baseurl + "rss.xml"; scratchpad.t = t; local (s = string.multiplereplaceall (string (adrfeed^.prefs.template), @t, false, "<%", "%>")); local (url = myTwitterProfileSuite.saveStaticFile (t.username, s, t.pagePath)); adritem^.permalink = t.pageUrl; //remember this for the feed bundle { //also save the page out to the home page of the site if flWriteHomePage { myTwitterProfileSuite.saveStaticFile (t.username, s, adritem^.feed + "/index.html")}}; return (t.pageUrl)}; bundle { //test code buildFeedPage (@config.myTwitterProfile.calendar.["2009"].["08"].["17"].["00029"], true)}
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.