|
|||||||||||||||||||||||||||||||
|
3. Use Relative LinksBuild your web site inside just one main folder. Then, within that folder, use a "flat" filing system to organize your information. That is, use only one (or two) layers of folders inside your main Web folder. You'll begin losing files and folders if you begin stacking them more deeply than this. [Note: Most new Web or HTML editors automatically create relative links. If your editor does not automatically support relative addressing, the following discussion will be helpful] Don't Use Absolute Paths An absolute path is a URL which specifies the complete location, from beginning to end. They start with "http:" or "file:" or with a slash. Examples of absolute links to avoid: <A HREF="file:///Main/Fruits/A.htm"> <A HREF="/Main/Colors/C.htm"> <A HREF="http://www.gsn.org/Main/Fruits/B.htm"> Do use Relative Paths Let's use the image below to illustrate these principles. The image shows a main project folder named "Main" which contains five other folders. The "Fruits" folder contains two web pages: A.htm and B.htm. The "Color" folder contains three pages, one named "C.htm", and the "Musical Styles" folder contains three pages, one named "D.htm". Now let's see how we should describe our paths from one page to another. Let's say you want to link from A.htm to B.htm. Since they are both in
the same folder, this is easy: you use this link: Now let's say that you want to link C.htm from page D.htm. This is more complex, because C.htm is in a different folder. If you use absolute addressing, you would say, "Start at the Main
folder, go into the Colors folder and find C.htm." This would look like this: The solution is to use relative addressing, in which you say, "We
are already in the "Musical Styles" folder. Now move up one folder (which is the
Main folder, go into the "Colors" folder and find C.htm." This would look
like this: The symbol "../" means "move up one folder" and is the key to making relative addressing work. You can combine multiple up-links to move up as many folders as you
need. For instance, " If you use relative links in this fashion, you can move the entire root folder or disk to any other server, disk, or location on your hard disk drive and it will function perfectly. Note: You can learn more about directories and relative links. |
||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
Global SchoolNet Foundation copyright © 1996-2004 All Rights Reserved Last Update: 02-Dec-2003 |