next up previous contents index
Next: Previewing Your Work Up: Creating Web Pages in Previous: Viewing and Printing Memos

Laying Out a Document

 

   

Once you start working with HTML, you will find that you can have many files making up one paper document, so it's important to think about arranging your files before you begin.

In order to enter hypertext links in your files, you need to know the relative locations of the other files. So, planning ahead will help you get your work done more efficiently and make it more easily transferable either from another directory on RCS or from a PC.

As an example, suppose you are creating an on-line brochure about your department. The brochure starts out as one file, but it has several parts:

This whole document could remain one file, but it would make it harder to find the information in it. To make your document more readable on-line, you can divide this file into several smaller files and then create links between them. The smaller files would be:

You will need to create a subdirectory Brochure in the directory /dept/mydept, which, in turn, includes the subdirectories Special and Case, in which you can put, respectively, the information about the special parts of your department and the case studies.

The directory structure will look like this:

                  /dept/mydept
                       |
                       |
                   /Brochure
                       /\
                      /  \
                /Special   /Case

The file general.html is your starting point for your readers. It will include the general description of your department, as well as the table of contents from the brochure, making each item a hypertext link to the file or section of the brochure to which it relates.

Here's where you should use relative path names. In UNIX, you can change from one directory to a directory one level higher by entering the command cd ..; enter cd Case to change from the current /dept/mydept/Brochure directory to the Case subdirectory.

Below is the contents of the file general.html. Notice that the hypertext links to the other sections are made with relative path names.

<html>
<body>
<title>Brochure</title>
<h1>Departmental Brochure</h1>
Here is the General Description
<h2>To Read Other Parts of the Brochure</h2>
<ul>
<li><a href="Special/special1.html">Special part 1</a>
<li><a href="Special/special2.html">Special part 2</a>
<li><a href="Special/special3.html">Special part 3</a>
<li><a href="Case/Case_info.html">List of Case studies</a>
</ul>
</body>
</html>

When a user clicks on any of the Special links, they will go to the pages that describe each special part of your department. By specifying Special/special1.html, you are telling the browser to look down one subdirectory, called Special, for the files. You do not have to type the entire path (/dept/mydept/Brochure/Special), as long as the file general.html is stored in the directory above the Special subdirectory.

When someone clicks on the Case_info.html link, they will go to a page in the Case subdirectory, in which you have separate links to each of the five case studies. That page could look like this:

<html>
<body>
<title>Case Studies</title>
<h1>Case Studies</h1>
Here are the 5 case studies we did last year:
<ul>
<li><a href="study1.html">Study 1</a>
<li><a href="study2.html">Study 2</a> 
<li><a href="study3.html">Study 3</a>
<li><a href="study4.html">Study 4</a>
<li><a href="study5.html">Study 5</a>
</ul>
</body>
</html>

In this case, all the files are in the same directory as the page from which the links were made, so there is no need to specify the directory in which they are located.

This all may seem confusing to you now, but it will become much clearer once you start trying to break up and organize your own files. Keeping them organized makes it easier to update them and find them, especially if you have to add or delete files as time goes on, or add new sections to documents.

In this example, using relative path names instead of complete path names saved typing, but also would make it easier to move the group of files. For example, one day you could move this entire brochure from /dept/mydept/Brochure to a new location such as /rpinfo/mydept/Brochure without having to change any links because the links only refer to directories and files below the /Brochure directory.


next up previous contents index
Next: Previewing Your Work Up: Creating Web Pages in Previous: Viewing and Printing Memos

Send comments to consult@rpi.edu