9 | LINKING
The ability to make hyperlinks between information sources is arguably the most important feature of that great repository of pet photographs they call the Internet. Spots are no different in this respect than regular old Web pages. Links are accomplished in 3DML files by naming ENTRANCEs and EXITs in your file, and pointing them at each other, or at outside SPOTs or Web pages.
Links can occur anywhere in a SPOT. You can place an EXIT on any block, including an empty block. Traditionally, however, EXITs are used in conjuction with the PORTAL Block. When a visitor to your spot rolls their mouse over an EXIT, the destination title or URL will appear just below the cursor, to let them know where the link will take them.
When you are making your own spots, you'll want to use the <CREATE> tag to put an image that indicates where the link leads in the doorway of your PORTAL. But for now, we'll just use the default Flatland logo image.
The <EXIT> tag
Like the <ENTRANCE> tag, the <EXIT> tag can be placed anywhere within the <BODY> tags. Some builders like to put them directly after the Level in which they occur, others like to keep them all together at the bottom.
The <EXIT> tag has five attributes: LOCATION, HREF, TRIGGER, TARGET, and TEXT. LOCATION is the x,y,z coordinate at which the exit occurs, [with 1,1,1 being in the top left (or northwest) corner of the bottom level.] HREF is where the link leads to, expressed as the destination's file name or URL, followed by the entrance name, separated by a "#". TRIGGER defines how the EXIT may be activated, either by clicking on it, stepping on it, or both. To make an EXIT both "click on" and "step on" activated, just include both options in the TRIGGER attribute: TRIGGER="click on, step on". By default, EXITS placed in the BODY of the 3DML file will be "click on". Exits placed on PORTAL blocks will be both "click on" and "step on". If you want to open the link in a new window or frame of an html page, you can use the TARGET attribute to name where the link will open, just as you would in HTML. TEXT specifies the text that will appear by the user's cursor, indicating that the link is active. Usually this text is the title of the page or spot that the link leads to. But you can of course put any text here that you wish. If no TEXT attribute is specified, then no text will appear.
ENTRANCEs and EXITs
in the <CREATE> tag
A note about Entrances
We are going to make a link between firstspot.3dml and tallspot.3dml, and a link between two different locations within tallspot.3dml.
Then, add this exit tag just before the </BODY> tag:
<EXIT LOCATION="(5,1,1)" HREF="tallspot.3dml#default" TRIGGER="click on, step on" TEXT="tallspot"/>
This has established a one-way link from the PORTAL in firstspot.3dml, located at (5,1,1), to the default entrance in tallspot.3dml. A visitor can travel from firstspot.3dml to tallspot.3dml, but not back again, because there is no <EXIT> tag in the tallspot.3dml file.
a two-way link
<EXIT LOCATION="(5,1,1)" HREF="firstspot.3dml#default" TRIGGER="click on, step on" TEXT="firstspot" />
And put a PORTAL in that location to mark the link:
Save both of your files, and open firstspot.3dml in your browser. Go back and forth between the links!
You probably noticed that when you linked back into firstspot.3dml, you didn't enter in the same location from which you left. This is because there is only one <ENTRANCE> tag in firstspot.3dml, the default entrance at (5,8,1). In order to create an exact two-way link between two locations, each location must have BOTH an <ENTRANCE> tag and an <EXIT> tag that point to each other. Also remember that the links would work just fine with or without the PORTAL blocks. The PORTAL is just a convention (like highlighted text in HTML) to indicate that a link is present.
a direct two-way link
<ENTRANCE LOCATION="(5,2,1)" NAME="second" ANGLE="180,0"/>
And go back to the <EXIT> tag in tallspot.3dml and change it to read:
<EXIT LOCATION="(5,1,1)" HREF="firstspot.3dml#second" TRIGGER="click on, step on" TEXT="firstspot" />
Now you have a direct link between two locations in two different spots. Next, we'll add an internal link between two different locations within tallspot.3dml.
a Direct Link
<ENTRANCE LOCATION="(7,6,1)" NAME="floor"
And mark your links with PORTALs. Change Level 1
to the following:
And then add a Level 3 that looks like this:
<MAP DIMENSIONS="(9,9,3)" />
Save both of your files and open tallspot.3dml in your browser. Experiment jumping around between all of the links you have created.
Copyright 1999, 2000 Flatland Online, Inc.