• Aucun résultat trouvé

How to make Web filenames

Dans le document Creating Web Pages (Page 138-141)

Here are a few things to keep in mind when naming your files for the Web:

When you tell a Windows program to save your file as a text document, it saves just the actual text characters that you see on-screen, without any formatting commands.

The Windows program also assigns the suffix .txtto the file, unless you tell it oth-erwise. The filename’s suffix, which is usu-ally hidden from you by Windows, helps Windows figure out what kinds of programs the file “belongs” to. When you name your file with the suffix .htm, it overrides the .txtsuffix.

When your file ends in .htm, Windows rec-ognizes it as an HTML file. This extension allows you to easily open the file from a Web browser program such as Internet Explorer. By doing this, you can preview your file as you work on it — and, more importantly, other people can open your file as a Web page when you put it on a Web server.

You may also see some Web pages with filenames ending in .html; this suffix works on some servers. However, you should not end the filenames of your Web pages with .htmlbecause some programs that you may use to edit your file or to trans-fer it to a Web server truncate the suffix to

.htm. This breaks any links you have to the document, because they refer to the file using its original suffix, .html. Save your-self potential headaches and always use .htmas the suffix for your HTML files.

Not putting spaces in your Web filenames, keeping them eight characters or less in length, and using only lowercase letters in the filenames is also important. Why?

Because your Web page might be pub-lished on a UNIX server, or on a server that runs an old version of Windows. Different servers have different filename rules. Only a filename with its main part eight charac-ters or less, with .htmas its suffix, and with no uppercase characters are sure to stay intact and accessible when you publish your Web page onto a Web server.

You should also keep your folder names all low-ercase and eight characters or less, for the same reasons. If your folder name changes when you transfer your Web page to a server for publication, links to the Web pages and graphics files in the folder can be broken. There’s not much that’s more frustrating — or embarrass-ing, especially if you’re creating a Web page for a company or other organization — than having your hyperlinks break when you move your Web site from your own machine to a Web server.

Follow these steps to create your initial Web page in Composer:

1. Open Composer. First open Netscape Navigator by choosing Start➪

Programs➪Netscape7.1➪Navigator. Then choose Window➪Composer.

Netscape Composer opens with an empty window.

After you open Composer, you can close Navigator, and Composer still stays open.

2. Give your document a title by choosing Format➪Page Title and Properties.

The Page Properties dialog box opens.

3. Enter the title for your document. (A Web browser displays the title in the top of the file window.) Optionally, you may want to enter your name and a file description in the Author and Description areas. Click OK when you finish.

The Author and Description fields are most useful if you’re working with others on the same machine or on the same Web site. They help identify who on a team is working on a document and what each HTML file is for.

4. Preview your document’s HTML by choosing View➪HTML Source or clicking the <HTML> Source tab at the bottom of the editing window.

Your document’s HTML source appears, as shown in Figure 6-5. Note that you have no actual content in your document, but already you have almost a dozen HTML tags! These tags are automatically generated by Composer. Don’t worry, most of the work you do from here on has results that are directly visible in your Web page.

Note the sets of tag pairs that are standard in any HTML document: the

<html>and </html>, <head>and </head>, <title>and </title>, and <body>and </body>tag pairs.

Also note the META tags. For a brief description of META tags, see the section “I Never META Tag I Didn’t Like” later in this chapter.

The main part of your Web document goes between the <body>and

</body>tags. The tag with an exclamation point, <!-- The main content... -->, contains a comment. The browser ignores and does not display this tag and its contents in your document, but the comment tag allows you to make notes to yourself in the HTML text.

The text between the <title>and </title>pair of tags is the title of the document. The Web browser in the top of the file window displays it.

5. Return to a normal view of your Web page by choosing View➪Normal Edit Mode or by clicking the Normal tab at the bottom of the editing window.

Your empty editing window appears. Note, however, that your Web page’s title appears at the top of the editing window.

If you don’t give your document a title before you save it, Composer prompts you to enter a title before saving.

6. Begin the process of saving the file by choosing File➪Save.

The Save Page As dialog box opens.

Both the Save and Save As commands open the Save Page As dialog box when you’re saving a file that you haven’t previously saved.

7. To create a new folder for your Web page files, use the pull-down file menu at the top of the Save Page As dialog box to navigate to the spot where you want to create your new folder. Then use the Create New Folder icon — the folder with the star on it — to create the new folder. Name it according to the rules in the sidebar, “How to make Web filenames.” Then open the new folder to save your file into it.

See the sidebar, “Files of a feather,” for details on why keeping all the files that make up your Web page or Web site in one place is important.

Figure 6-5:

Composer lets you go to the (HTML) source.

8. Use the Save as Type pull-down menu to save your file as an HTML files document.

Composer saves your document with the suffix .htmlto indicate that it’s an HTML document. (You don’t usually see the suffix of a Windows filename, but it’s how Windows knows which icon to use when display-ing a file, and what programs can open it.) However, in the next step we’ll change the suffix to .htm. See the sidebar, “How to make Web file-names,” for details on why ending your HTML files’ filenames with .htm is important.

9. Add .htmto the end of the filename to make sure it is given the .htm extension and not .html. Then Click the Save button.

Composer saves your file as an HTML document. Because it has the suffix .htmin the filename, you can easily open the file in a Web browser program to review it.

Dans le document Creating Web Pages (Page 138-141)

Documents relatifs