Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.macros.recentTitledBlogPosts
on recentTitledBlogPosts (maxposts=25, maxTitleLength=infinity, flIncludeWhen=true, catname="", cellspacing=0) { <<Changes <<11/11/02; 8:10:24 AM by DW <<As far as I know there is no "broder" attribute on an HTML <table> element. Changed it to "border." <<8/9/02; 6:45:43 PM by JES <<Render the link inside the div instead of rendering the div inside the link. Fixes non-compliant HTML. <<3/31/02; 2:23:49 PM by DW <<Optional param allows you to control cell spacing in the table. <<3/29/02; 9:55:33 AM by DW <<Created. http://radio.userland.com/recentTitledBlogPosts local (adrdata = radio.weblog.init (), adrcat); if catname != "" { //set adrcat adrcat = @adrdata^.categories.[catname]}; local (htmltext = "", indentlevel = 0); on add (s) { htmltext = htmltext + (string.filledstring ("\t", indentlevel) + s + "\r\n");}; add ("<table cellpadding=\"0\" cellspacing=\"" + cellspacing + "\" border=\"0\">"); indentlevel++; on getDateString (when) { //customized version of radio.string.getDateString local (day, month, year, hour, minute, second); date.get (when, @day, @month, @year, @hour, @minute, @second); return (month + "/" + day + "/" + string.delete (year, 1, 2))}; local (i, adrpost, ct = 0); for i = sizeof (adrdata^.posts) downto 1 { adrpost = @adrdata^.posts [i]; if defined (adrpost^.title) { local (flinclude = true); if catname == "" { //generating list for the home page category if defined (adrpost^.flNotOnHomePage) { flinclude = not adrpost^.flNotOnHomePage}} else { if not (adrcat^.storylist contains number (nameof (adrpost^))) { flinclude = false}}; if flinclude { local (title = adrpost^.title); if sizeof (title) > maxTitleLength { title = string.mid (title, 1, maxTitleLength) + "..."}; local (url); radio.weblog.getUrlForPost (adrpost, @url, catname, adrdata); add ("<tr>"); indentlevel++; add ("<td><div class=\"recentPostTitle\"><a href=\"" + url + "\">" + title + "</a></div></td>"); if flIncludeWhen { add ("<td align=\"right\" valign=\"top\"><div class=\"recentPostWhen\"> " + getDateString (adrpost^.when) + "</div></td>")}; add ("</tr>"); indentlevel--; if ++ct > maxposts { break}}}}; add ("</table>"); indentlevel--; return (htmltext)} <<bundle //test code <<webbrowser.displaytext (recentTitledBlogPosts ())
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.