Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Taking_Your_Talent_to_the_Web.pdf
Скачиваний:
6
Добавлен:
11.05.2015
Размер:
9.91 Mб
Скачать

Taking Your Talent to the Web

185

In Windows: First of all, you need to install the entire Communicator program, not just the Navigator component. From Composer (the extremely limited semi-WYSIWYG “page creation” tool bundled with Netscape’s browser), choose Edit then Preferences. Click Composer and register your external editor for HTML Source. There. That really wasn’t so bad.

Doin’ it in Internet Explorer

First, open Explorer’s Preferences. Go to File Helpers and click Add.

In a new, blank dialog box, type Source Code under Description, .html under Extension, and source/html under MIME type.

In the File Type area, click Browse. It sounds as if you’re about to browse the Web, but you’re not. You are actually navigating your hard drive to locate your web editor of choice. Select it, and the File type and File creator areas will be filled in automatically.

You’re not done yet. Under Handling, choose Post-Process With Application. Hit the second Browse button, select your web editor one more time, and then hit OK. Then stand on your head and recite the Cub Scout pledge. Just kidding about the pledge thing.

Now when you View Source, the code will open in your favorite web editor. Not push-button easy, but it works—and you only have to do this once.

We figure these tips alone justify the cost of buying this book, and we expect you to dog-ear this page and fondle it quietly when you think no one is watching.

ABSOLUTELY SPEAKING, ITS ALL RELATIVE

HTML links can work several ways. The simplest link (and often the easiest to maintain) is the relative link.

Two files reside in the same directory:

index.html

thankyou.html

A relative link from index.html to thankyou.html looks like this:

There is a special message for you on our <a href=”thankyou.html”>Thank You</a> page.

186 HOW: HTML, the Building Blocks of Life Itself: Absolutely Speaking, It’s All Relative

By contrast, an absolute link might look like this:

There is a special message for you on our <a href=”http://www.ourcompany.com/ thankyou.html”>Thank You</a> page.

Or even this:

There is a special message for you on our <a href=”http://www.ourcompany.com/ customerrelations/special/thankyou.html”>Thank You</a> page.

These are called <ABSOLUTE> links because they refer to an absolute, concrete location in web space. (Well, as real or concrete as “web space” gets, anyway.)

When two pages reside in the same directory, there is no need to use absolute links. Using relative links lowers your character count (you can get rid of http://www.ourcompany.com/customerrelations/special/), and that, in turn, conserves bandwidth.

Relative links are easy to maintain on simple sites (though they become fiendishly complex as a site grows and uses more and more directories). For instance, if all images are kept in a directory called Images, the URL to an image file might read like so:

<IMG SCR=”images/image.gif”>

We have left out the image’s height, width, and <ALT> attribute to simplify the presentation of this idea. However, as previously mentioned, it is always important to include an image’s height and width to help some browsers display the layout more quickly. And, as also previously mentioned, it is essential to include <ALT> attributes so that those with visual disabilities or those who surf with images turned off will have some idea of the image’s function.

The more complicated the site’s directory structure, the likelier relative links are to require debugging. For instance, the reader is here:

somesite.com/julyissue/index.html

And you wish to direct her back to the index page at:

somesite.com/index.html

Taking Your Talent to the Web

187

The URL would read as follows:

<a href=”../index.html”>Back</a> to the Index Page.

The two dots (..) preceding the slash mean “go up one directory level before locating this file.”

With more directories, you have more and more complex links:

<a href=”../../../../../index.html”>Back</a> to the Index Page.

This can quickly lead to madness. Are you stuck writing out full, absolute

URLs? Heck, no.

Instead, you can use a shorthand form of absolute linking to retain the advantages of relative URLs (portability, low bandwidth) while maintaining the clarity of absolute URLs.

Absolute URLs also can be written like so:

/index.html

Where the slash represents “root directory.”

By using this method, if you wished to move from the July Issue index page up one directory to the root level index page, your URL would look like this:

Return to the <a href=”/index.html”>front page</a>.

Or like this (which is even smaller and doesn’t hardcode the default directory index filename):

Return to the <a href=”/”>front page</a>.

And reversing the direction, a link from /index.html to /julyissue/index.html would look like this:

Read the <a href=”/julyissue/”>July issue</a>.

Unfortunately, absolute URLs of this kind cannot be tested offline. You must load these pages to your web server to make certain the links work correctly.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]