At Dave’s request, I started a new category for documenting my ongoing Radio development work. It’s rendered in HTML here, and you can subscribe to it by clicking this link.
Category: <span>Macros</span>
Here’s a macro that lists all of your stories by title, with links to the stories. The list isn’t sorted, but a somewhat adventuresome macro-writer should be able to figure out how to do that without much trouble.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<% local (s = "", pc = file.getPathChar ()); local (folder); folder = user.radio.prefs.wwwFolder + "stories" + pc; fileloop (f in folder, infinity) { if file.fileFromPath (f) == "index.txt" {continue}; local (adrfile = @user.radio.settings.files.[f]); if defined (adrfile^) and (adrfile^.upstream.url != "") { s = s + "<a href=\"" + adrfile^.upstream.url + "\">"; s = s + adrfile^.title; s = s + "</a>"; s = s + " (" + date.shortString (adrfile^.postTime) + ")"; }; }; return (s) %> |
Comments closed
This is the first post to my Macros category!
Here’s a neat little trick for changing the date format in your Day template. I wanted my dates to show up in YYYY.MM.DD format, so I changed <%longDate%> in my Day template to the following:
1 2 3 4 5 6 |
<% local (d = date ("<%shortDate%>")); local (month = string.padWithZeros (date.month (d), 2)); local (day = string.padWithZeros (date.day (d), 2)); return (date.year (d) + "." + month + "." + day) %> |
Comments closed
Comments closed