Currently Subscribed To
This script, as well as these instructions, originated with Jon Udell. Thanks for sharing!
To get a Currently Subscribed To listing through an XML-RPC call:
- Copy the script below into your favorite text editor. Depending on your browser and OS,
you may find that the < and > characters have come through as < and >. If
so, fix them.
- Save the script as a text file into the {Radio install directory}/Web Services directory. For the sake of
argument, let's name it subs.txt
- Find the place in a template or page where you want the listing to appear, and enter one of these incantations:
- <%params = {}; xml.rpc ("127.0.0.1", 5335, "radio.subs", @params)%>
- <% ["xmlrpc://127.0.0.1:5335/RPC2"].radio.subs () %>
- <% ["soap://127.0.0.1:5335/"].radio.subs () %>
on subs(imgRoot="http://radio.weblogs.com/0105455/images/") {
on imgTag (iName="shim.gif",alt="",height="",width="") {
local (tag = "<img border='0' src='");
tag = tag + imgRoot + iName + "' alt='" + alt +"'";
if (height != "") {
tag = tag + " height='" + height + "'"};
if (width != "") {
tag = tag + " width='" + width + "'"};
tag = tag + ">";
return tag;};
local(c=0);
local(radioMessage="Radio UserLand users: click to subscribe. ");
radioMessage = radioMessage+"Other folks: use the RSS link to acquire this channel.";
local (t);
new (tableType, @t);
for adr in (@aggregatorData.services) {
if (defined(adr^.compilation.channellink)) {
local (title);
if ( defined(adr^.compilation.channeltitle) ) {
title = adr^.compilation.channeltitle}
else {
title = adr^.compilation.channellink};
local(channelUrl = adr^.compilation.channellink);
local(rssUrl = nameOf(adr^));
local (l);
new (listType, @l);
l[0] = channelUrl;
l[0] = rssUrl;
t[title] = l;
c=c+1}};
target.set(@t);
table.sortBy("Name");
target.clear();
local(s = "<table name='subs' border='0' cellspacing='0' cellpadding='1' width='139'>");
on add(t) {
s = s + t};
local(sr = "<tr><td class='realsmall' width='19'>" + imgTag(width: "19", height: "3") + "</td>");
sr = sr + "<td class='realsmall' width='95'>" + imgTag(width: "95", height: "3") + "</td>";
sr = sr + "<td class='realsmall' width='19'>" + imgTag(width: "19", height: "3") + "</td></tr>";
add("<tr><th class='realsmall'> </th><th align='center' class='realsmall'>");
add(" currently subscribed:</th><th> </th></tr>");
add(sr);
for adr in (@t) {
local(title = string.replace(nameOf(adr^),"'apos","'"));
local(l = adr^);
local(channelUrl = l[1]);
local(rssUrl = l[2]);
add("<tr valign='top'><td class='realsmall' valign='middle' align='center'>");
add("<a href='http://127.0.0.1:5335/system/pages/subscriptions?url='");
add(string.urlEncode(rssUrl) + "'>");
add(imgTag("tinyCoffeCup.jpg", radioMessage,"10","10") + "</a><br></td>");
add("<td class='realsmall' wrap='true'><a href='" + channelUrl + "'>" + title + "</a></td>");
add("<td class='realsmall'><a href='" + rssUrl + "'>");
add(imgTag("tinyXML.gif", "RSS Link","7","16") + "</a>");;
add("</td></tr><tr><td colspan='3' class='realsmall'> </td></tr>");;
add(sr);};
add("<tr align='center'><td class='realsmall' colspan='3'>");;
add("Here's <a href='http://radio.weblogs.com/0100887/2002/02/24.html#a88'>");;
add("how this works</a></td></tr></table>");;
return s;}
|
© Copyright
2002
Dr. Bonzo.
Last update:
4/22/2002; 10:31:06 PM.
This theme is based on the SoundWaves
(blue) Manila theme. |
|
|