Monday, November 08, 2010 at 12:00 AM.
scripting2Suite.server.getCrumbTrail
on getCrumbTrail (baseurl, thedate, fldaybold=false, flmonthbold=false) {
<<Changes
<<6/8/10; 4:58:41 PM by DW
<<If fldaybold is true then we don't hot-up the day. This is used when the crumb trail is on the archive for the day.
<<If flmonthbold is true, then we're doing the trail for a month archive page. We stop at the month and it's bold, not hot.
local (htmltext = "\r\r", indentlevel = 0, day, month, year, hour, minute, second);
date.get (thedate, @day, @month, @year, @hour, @minute, @second);
local (padmonth = string.padwithzeros (month, 2), padday = string.padwithzeros (day, 2));
on add (s) {
htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n"};
on addcrumb (title, path, fllast=false) {
local (url);
if path beginswith "http://" {
url = path}
else {
url = baseurl + path};
if fllast {
sep = ""}
else {
sep = " > "};
if (fldaybold or flmonthbold) and fllast {
add ("<b>" + title + "</b>")}
else {
add ("<a href=\"" + url + "\">" + title + "</a>" + sep)}};
addcrumb ("Home", baseurl);
addcrumb ("Archive", "toc.html");
addcrumb (year, "toc.html#y" + year);
addcrumb (date.monthtostring (month), year + "/" + padmonth + ".html", flmonthbold);
if not flmonthbold {
addcrumb (day, year + "/" + padmonth + "/" + padday + ".html", true)};
return (htmltext)};
bundle { //test code
webbrowser.displaytext (getCrumbTrail ("http://scripting.com/scripting2/davewiner/", clock.now (), 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.