Sunday, July 28, 2002

> Let me tell you a funny story with a happy ending. For a while now I've been thinking that it would be nice to remove the images for the daily archive permalinks and just have the longDate linked to the archive. It sounds simple enough, but when I dove into the code I found that the built-in dayTemplate macro, archiveLink is processed deep within the bowels of radio.weblog.render. I set out to write my own macro to replace this one, but quickly found a couple of road blocks. In order to calculate the archive link I needed to know two vital pieces of information, neither of which was readily available to my macro.

The first was flArchivePage, which tells me whether the page being published is the home page or an archive page and thus, whether or not it needs a "../../" pre-pended to the url. I consulted the highest sources and learned that I could get flArchivePage by calling radio.file.getAbsolutePath. Of course in order to call that script I need to pass it the path of the file being rendered, which fortunately can be found in the pageTable, pta^.radioResponder.fileBeingRendered.

The second was archiveFileExtension, which I learned that I could get by calling radio.webserver.gatherAttributes, which returns the address of a table, which contains the renderedFileExtension, which may or may not include a leading '.', and if not found by radio is assumed to be "html".

So I started digging in to write this monsterous macro to perform a menial task. I was thinking about how cool it is to have multiple layers of macro processing, ala the dayTemplate, when suddenly it occurred to me...

I didn't need to write a macro to do what I wanted!

All I had to do was to go to my Customized Images preferences page and replace the "Day-level permalink":

<img src="http://radio.weblogs.com/0001018/images/dailylinkIcon.gif" height="15" width="12" border="0" alt="Permanent Link to Daily Archive" />

With the longDate macro:

<%longDate%>

Viola!

If it was a snake, then it would have bit me...   7:34:33 PM  Link  Google It!  
> Dictionary.com Word of the Day: quorum
[Dictionary.com Word of the Day]   1:24:28 PM  Link  Google It!