Free Newsletters
Technology & Business Daily

InfoWorld
Log-in | Register

  Saturday, March 16, 2002 

Listing titled items on a storyList page

If I've got this right, posting this item should update my new storyList page, which enumerates all my titled items in reverse order, so that it also includes this item.

Hey, it worked. Cool. OK, here's how. First, a script which gathers all the posts that have titles:

on storyList()
 {
 local (s = "");
 local (adrblog = radio.weblog.init ());
 local (adrposts = @adrblog^.posts, i);
 for i = sizeof (adrposts^) downto 1
  {
  local (adr = @adrposts^ [i]);
  local (t = adr^);
   try
    {
    local( title = t.title); // if none, skip to next post
    local(d = date.year(t.when) + "/" + string.padWithZeros(date.month(t.when),2) + "/" + string.padWithZeros(date.day(t.when),2));
    local( itemno = nameOf(adr^) );
    regex.subst("^0+","",@itemno);
    s = s + "<p>" + d + ": " + "<a href=\"http://radio.weblogs.com/0100887/";
    s = s + d + ".html#a" + itemno;
    s = s + "\">";
    s = s + title;
    s = s + "</a></p>";
    };
  };
 return(s);
 };

I saved this as /radio/Macros/storyList.txt. Then I wrote a story that contains nothing but a reference to the macro, in other words:

<% storyList() %>

So far so good. But how to make it update when new postings appear? I got the necessary ideas from Russ Lipton and Simon Fell.

From Russ, I got the idea for a script that touches the storyList, so it will re-upstream. From Simon, I learned of the callback that can invoke that script when an item is published. So, I wrote this:

on updateStoryList(adrPost)
    {
    on touch(path)
        {
        try
        { file.touchPath(path) }
        };
    file.visitFolder(user.radio.prefs.wwwfolder + "stories\\2002\\03\\16", infinity, @touch);
    };

And I entered it as a script, called updateStoryList, in the table user.radio.callbacks.publishItem.

Nice. Now, I think I'll have a neat and automatically maintained list of my titled items.

One gripe, which I noticed again while doing this: the permalink's target (e.g., <a name="a146">) has been in the wrong place since the advent of titles. It should come before, not after, the title.

 

 

Expanding inbound feeds, trimming outbound feeds

Marc Barrot comments on the new driver architecture for RSS aggregation:

This is a really cool feature. It opens up Radio's aggregator to new syndication formats, or to alternate formatting of existing formats, the first very clever answer to a current on-going issue with rss syndication, cf here, here, and here.

I think it answers a different (and more interesting) question: how can non-RSS formats flow into the news page? Phil Wolff, in the same DG thread:

Does this mean I can syndicate/aggregate XML DTDs completely unrelated to news/blogging (with appropriate code, of course)? For example, job listings, resumes, RFPs, etc., defined elsewhere?

Yes. And this is interesting, to the extent that XML formats of the multiple-item-per-file flavor exist, or can be easily produced -- say, from databases, using increasingly popular SQL-to-XML features.

It's worth noting that a UserTalk driver in Radio is not the only (and maybe not the easiest) way to assimilate such non-RSS formats into Radio. While not a huge fan of XSTL, transforming a non-RSS XML format into RSS .91, .92, or 1.0 (any of which Radio can already consume) is a really good use for XSLT. Note that Radio need not directly support XSLT in order to have the use of it. Web-service-based XSLT engines are available.

But to each his own. As the Perl folk say, There's More Than One Way To Do It.

In any case, this new feature deals with consumption of feeds by Radio. And it aims to broaden the universe of such feeds, which is a really good idea.

My questions were, instead, about tuning the production of feeds. One option,  as Rahul suggested, is to offer to truncate long descriptions. I think that could look something like this.

In system.verbs.builtins.radio.weblog.writeRssFile, change from:

add ("<description>" + adritemcache^.text + "</description>");

to:

desc = descriptionTrim (adritemcache^.text);
add ("<description>" + dec + "</description>");

where descriptionTrim reads a value from a Pref:

Truncate RSS Description? 0 means no, >0 means yes and specifies the length

As a general rule, I believe RSS is best used for notification, not bulk transfer. Readers of RSS feeds will benefit when writers can streamline such notifications, relying on the linking power of the web for follow-ups. Writers of RSS feeds, as we've said, can do this streamlining now, at the cost of some extra work -- writing a separate story, then blogging a link to it with a short leading blurb. In practice, I'm sure this will rarely happen. The truncation option, requiring no effort of the writer, should help writers notify readers, and readers assimilate lots of diverse notifications, with a minimum of friction.

 


Recent Entries


















































Sponsored Technology Links

 
 
 HOME  NEWS  BLOGS  PODCASTS  VIDEOS  TECHNOLOGIES  TEST CENTER  EVENTS  CAREERS   About | Advertise | Awards | RSS | Contact Us 

Copyright © 2008, Reprints, Permissions, Licensing, IDG Network, Privacy Policy, Terms of Service.
All Rights reserved. InfoWorld is a leading publisher of technology information and product reviews on topics including viruses,
phishing, worms, firewalls, security, servers, storage, networking, wireless, databases, and web services.

CIO :: ComputerWorld :: CSO :: Demo :: GamePro :: Games.net :: IDG Connect :: IDG World Expo
Industry Standard :: IT World :: JavaWorld :: LinuxWorld :: MacUser :: Macworld :: Network World :: PC World :: Playlist