| Rod Waldhoff's Weblog |
|
|
Radio Tidbits First Posted: 11 April 2003
Introduction
At the time I'm writing this (11 April 2003), I've been using Radio Userland for about two weeks, and I haven't poked around with Radio scripting very much in that time. (Frankly, I don't even know what language Radio scripting is using and/or is derived from. Python?) Nevertheless, I've learned a few things and thought I would try to share some of them here. (If for no other reason, to reciprocate for what I've learned from others who posted their Radio hacks.) I hope to update this document from time to time as I learn new tricks and come to understand the Radio framework and scripting language a bit better.
Static Macros
First Posted: 11 April 2003
If you have a block of HTML that you'd like to use in a number of templates, you can define a simple <%macro%> for it. To do this, create a file named myMacro.txt containing something like:
on myMacro() {
local (htmlText = "");
htmlText = htmlText + "<!-- here's my macro -->\n";
htmlText = htmlText + "<hr size=\"1\" noshade=\"true\">n";
htmlText = htmlText + "Text of My Macro\n";
htmlText = htmlText + "<hr size=\"1\" noshade=\"true\">n";
htmlText = htmlText + "<!-- end my macro-->\n";
return htmlText;
}
and drop it into your
To post comments on this section, please use this blog entry.
Waypath It!
First Posted: 11 April 2003
The Google It! macro, if you've never seen it, is a Radio Userland macro that lets one add a line like Waypath.com is a sort of weblog search engine. Among other features, you can point waypath to a blog entry (really any web page) and find a list of related weblog entries (for some definition of "related"). For the few examples I tried it with, this seemed to work pretty well. I thought it would be fun to add a "Waypath It!" link to my item template, just like the "Google It!" macro Radio provides. And here it is: <%
local (adrpost = @weblogData.posts.["<%paddedItemNum%>"]);
return ("<a href=\"http://nav4.waypath.com/rwn.jsp?url=" +
string.urlEncode(
"http://radio.weblogs.com/0122027/" +
date.year(adrpost^.when) +
"/" +
string.padWithZeros(date.month(adrpost^.when),2) +
"/" +
string.padWithZeros(date.day(adrpost^.when),2) +
".html#a<%itemNum%>") +
"\" title=\"view related weblog entries from waypath\">waypath</a>")
%>See my weblog for examples of this.
I added this directly to my #itemTemplate. It'd be nice to put this into a little macro so all one needs to do to invoke it is
This would be a whole lot easier, of course, if I didn't have to generate the permalink URL "manually". Note to the Radio development team, a
To post comments on this section, please use this blog entry.
|
recent posts
Currently Reading
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
© Copyright 2003 Rodney Waldhoff.
Last updated: 12/8/2003; 10:45:39 AM. |