8/10/03..figured out something interesting with…

August 9, 2003 Comments Off on 8/10/03..figured out something interesting with…

8/10/03..figured out something interesting with the table of contents page..unless I enter a new post here, it doesn’t update..there has got to be a way to make this work like an actual table of contents..i found a script in the discussion board but not sure where to start with it

toc.txt file in your www directory:

#title "Table of contents"
<%
local (ret = "", lastMonth = nil, wbd = radio.weblog.init(), myUrl);
 
on getTitle(adrPost) {
  if defined (adrPost^.title) { return adrPost^.title; };
  return string.ellipsize (searchEngine.stripMarkup (string (adrPost^.text)), 70);
};
 
for i = sizeof (wbd^.posts) downto 1 {
  if not (radio.weblog.getUrlForPost (@wbd^.posts[i], @myUrl)) { continue; };
  if(lastMonth != date.month (wbd^.posts[i].when)) {
    lastMonth = date.month (wbd^.posts[i].when);
    if(ret != "") { ret = ret + "</ul>n\n"; };
    ret = ret + "<h2>" + date.monthToString (lastMonth) + " " + date.year (wbd^.posts[i].when) + "</h2>n\n<ul>n";
  };
  ret = ret + "<li>" + date.day (wbd^.posts[i].when) + ": <a href='" + myUrl + "'>" + getTitle(@wbd^.posts[i]) + "</a></li>n";
};
 
return ret + "</ul>n"
%>

Categories : Radio Userland