Inter-Application Linking

Apologies for Arcanity

What you're about to see is arcane and may look to you like I have ported DOS to the Newton. But a lot of you have asked me how to make links between objects under NPDS so I am going to show you how I would do it. We'll use an example from which you can abstract what you wish.

Creating a link to YOUR vCard

When you move your cursor over a link to NPDS data, you see a long, seemingly nonsensical URL. However, it's not quite the gibberish it seems to be. I developed a standard reference scheme for retrieving soup entries and the data required for this process is encoded within the URL. If I were to do a search for "Joe" on my Newton's Cardfile, I'd get 3 cards with links to the following 6 "files"

/cards/2230468$7.vcd, /cards/2230468$7.htm

/cards/2230468$45.vcd, /cards/2230468$45.htm

/cards/-336767$10.vcd, /cards/-336767$10.htm

If you examine these filenames, you can see the pseudo directory "cards" specifies what plugin handles tis request and within the actual filename part, you see a large number separated by a $ from a smaller number. These values represent the identity of the RAM (internal or card) device where this entry is found and the unique Newton soup ID code which is always an integer, respectively. An extension is appended ".htm" or ".vcd" and as you can guess, I make use of extensions to help specify how NPDS should display this entry. When possible, I try to map the extension to a standard Windows file extension.

These values are static unless you re-file the original reference, in which case the store ID would change. What this means is that you can link directly to any soup entry that we support under NPDS.

To illustrate this, let's over-ride the built-in USR_NAME server-side include with one that not only returns your name but a link to your vCard. To get your own vCard URI address, you need to fire up your server and do a search for your own name. Copy the link location of your vCard and verify that you can retrieve your vCard by entering that URI into the Location field of your browser. Now begins the fun..

Name: vCard + Name

SSI: USR_NAME

func(nullvar)

begin

local theOut:= "";

local theName:= GetUserConfig('name);

local vCard:= "/cards/8675309$4.vcd";

return "<A TARGET = \"_blank\" HREF=\""

& vCard & ">" & theName & "</A>";

end

OK. We're done. It was that easy. If you want to stop over-riding the built-in USR_NAME tag, turn this script off. If you want to return the HTML version of your name card, change the end of the URI from ".vcd" to ".htm".

There is, of course, a problem with this simple script. If you change owner cards, the vCard link won't point to the right person. You could add some code to catch different User Names and return the appropriate vCard link but you're on your own for that one.