1. Trang chủ
  2. » Công Nghệ Thông Tin

Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition) P67 ppt

10 197 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Organizing Your HTML Files for Publishing directory around to different servers without breaking the links. Having a Default Index File and Correct Filenames Web servers usually have a default index file that's loaded when a URL ends with a directory name rather than a filename. One of the questions you should ask your webmaster is, "What's the name of this default file?" For most web servers, this file is called index.html. Your home page, or top-level index, for each site should have this name so that the server knows which page to send as the default page. Each subdirectory should also have a default file if it contains any HTML files. If you use this default filename, the URL to that page will be shorter because you don't have to include the actual filename. For example, your URL might be http://www.myserver.com/www/ rather than http://www. myserver.com/www/index.html. Caution If you don't put an index file in a directory, many web servers will enable people to browse the contents of the directory. If you don't want people to snoop around in your files, you should include an index file or use the web server's access controls to disable directory browsing. Also, each file should have an appropriate extension indicating its type so the server can map it to the appropriate file type. If you've been reading this book in sequential order, all your files should have this special extension already and you shouldn't have any problems. Table 18.1 lists the common file extensions that you should be using for your files and multimedia. Table 18.1. Common File Types and Extensions Format Extension HTML .html, .htm ASCII Text .txt PostScript .ps GIF .gif JPEG .jpg, .jpeg PNG .png Shockwave Flash .swf AU Audio .au WAV Audio .wav MPEG Audio .mp2, .mp3 MPEG Video .mpeg, .mpg file:///G|/1/0672328860/ch18lev1sec3.html (2 von 3) [19.12.2006 13:50:03] Organizing Your HTML Files for Publishing QuickTime Video .mov AVI Video .avi Portable Document Format .pdf RealAudio .ra, .ram If you're using multimedia files on your site that aren't part of this list, you might need to configure your server to handle that file type. You'll learn more about this issue later in this lesson. file:///G|/1/0672328860/ch18lev1sec3.html (3 von 3) [19.12.2006 13:50:03] Publishing Your Files Publishing Your Files Got everything organized? Then all that's left is to move everything to the server. Once your files have been uploaded to a directory that the server exposes on the Web, you're officially published on the Web. That's all there is to putting your pages online. Where's the appropriate spot on the server, however? You should ask your webmaster for this information. Also, you should find out how to access that directory on the server, whether it's simply copying files, using FTP to put them on the server, or using some other method. Moving Files Between Systems If you're using a web server that has been set up by someone else, usually you'll have to upload your web files from your system to theirs using FTP, SCP (secure copy), or some other method. Although the HTML markup within your files is completely crossplatform, moving the actual files from one type of system to another sometimes has its drawbacks. In particular, be careful to do the following: ● Watch out for filename restrictions If your server is a PC and you've been writing your files on some other system, you might have to rename your files and the links to them to follow the correct filenaming conventions. (Moving files you've created on a PC to some other system usually isn't a problem.) Also, watch out if you're moving files from a Macintosh to other systems. Make sure that your filenames don't have spaces or other funny characters in them. Keep your filenames as short as possible, use only letters and numbers, and you'll be fine. ● Watch out for uppercase or lowercase sensitivity Filenames on computers running Microsoft Windows are not case sensitive. On UNIX and Mac OS X systems, they are. If you develop your pages on a computer running Windows and publish them on a server that has case-sensitive filenames, you must make sure that you have entered the URLs in your links properly. If you're linking to a file named About.html, on your computer running Windows, about.html would work, but on a UNIX server it would not. ● Be aware of carriage returns and line feeds Different systems use different methods for ending a line. The Macintosh uses carriage returns, UNIX uses line feeds, and DOS uses both. When you move files from one system to another, most of the time the end-of-line characters will be converted appropriately, but sometimes they won't. The characters that aren't converted can cause your file to come out double-spaced or all on a single line when it's moved to another system. Most of the time, this failure to convert doesn't matter because browsers ignore spurious returns or line feeds in your HTML files. The existence or absence of either one isn't terribly important. However, it might be an issue in sections of text that you've marked up with <pre>; you might find that your well-formatted text that worked so well on one platform doesn't come out that way after it's been moved. If you do have end-of-line problems, you have two options. Many text editors enable you to save ASCII files in a format for another platform. If you know the platform to which you're moving, you can prepare your files for that platform before moving them. If you're moving to a UNIX system, small filters for converting line feeds called dos2unix and unix2dos may be available on the UNIX or DOS systems. And you can convert Macintosh files to UNIX-style files by using the following command line in UNIX: tr '\015' '\012' < oldfile.html > newfile.html file:///G|/1/0672328860/ch18lev1sec4.html (1 von 3) [19.12.2006 13:50:04] Publishing Your Files In this example, oldfile.html is the original file with end-of-line problems, and newfile.html is the name of the new file. Using FTP to Upload Files In the preceding list of tips about moving files, I talked a little bit about FTP. If you already know how to transfer files using FTP, you can just skip this section. Most web surfers have used FTP whether they know it or not. When you download a file from a remote site to save on your computer, sometimes it's transferred via FTP rather than HTTP. When you're publishing files to a website, the way you use FTP is a bit different. When you download files from a public site, generally you log in anonymouslythe browser takes care of that for you. When you publish files using FTP, you log in with a specific username and password. Note You'll have to get the username and password you'll use to publish files using FTP from your Internet service provider or system administrator. Another difference between file downloads using FTP and publishing files using FTP is that when you publish files, you'll probably use an interactive FTP session. In other words, rather than just connecting, uploading a file, and disconnecting in one step, you'll create an FTP session, upload or download files as needed, and then disconnect. You'll manually open and close the connection and perform the required tasks while that session is open. One nice thing about FTP is that there are many clients available. First of all, all popular browsers can be used as FTP clients. That's why you can download files from FTP sites transparently using your browser. However, I recommend that you skip right past them and use something else to publish files. The FTP capabilities in web browsers were designed to make it easy to download one file, not upload an entire website. One option that's often available is publishing files through your HTML editing tool. Many popular HTML and text editors have built-in support for FTP. You should definitely check your tool of choice to see whether it enables you to transfer files using FTP from directly within the application. Some popular tools that provide FTP support include Adobe Dreamweaver and HomeSite, Barebones BBEdit, and Microsoft FrontPage. Text editors like UltraEdit and jEdit support saving files to a server via FTP as well. There are many others. If your HTML editor doesn't support FTP, or if you're transferring images, multimedia files, or even bunches of HTML files at once, you'll probably want a dedicated FTP client. FTP is common enough that there are many, many excellent FTP clients available. A list of some popular choices follows: ● CuteFTP (Windows) http://www.globalscape.com/ ● WS_FTP (Windows) http://www.ipswitch.com/ ● FTP Explorer (Windows) http://www.ftpx.com/ ● FileZilla (Windows) http://filezilla.sourceforge.net/ ● Cyberduck (Mac OS) http://www.cyberduck.ch/ ● Fugu (Mac OS) http://rsug.itd.umich.edu/software/fugu/ ● Transmit (Mac OS) http://www.panic.com/transmit/ file:///G|/1/0672328860/ch18lev1sec4.html (2 von 3) [19.12.2006 13:50:04] Publishing Your Files ● Fetch (Mac OS) http://fetchsoftworks.com/ How the FTP client is used varies depending on which client you choose, but there are some commonalities among all of them that you can count on (more or less). You'll start out by configuring a site consisting of the hostname of the server where you'll publish the files, your username and password, and perhaps some other settings that you can leave alone if you're just getting started. Caution If you're sharing a computer with other people, you probably won't want to store the password for your account on the server in the FTP client. Make sure that the site is configured so that you have to enter your password every time you connect to the remote site. Once you've set up your FTP client to connect to your server, you can connect to the site. Depending on your FTP client, you should be able to simply drag files onto the window that shows the list of files on your site to upload them, or drag them from the listing on the server to your local computer to download them. Remote Management Tools Most HTML editing tools enable you to manage and update the contents of your pages on a remote web server. Microsoft's FrontPage is a web development tool aimed at small to medium websites. FrontPage provides a WYSIWYG page editor and a site manager for managing document trees and links, as well as a variety of server extensions that can be used with a variety of servers, ranging from Windows-based to UNIX servers. These extensions enable Frontpage users to add a variety of features, including interactive discussion groups and other interactive features. These extensions also enable you to use FrontPage to upload files on the server as you make changes to your site. FrontPage enables you to publish your website to a remote server, regardless of whether it has the FrontPage Server Extensions installed. Other site development and management tools, such as Adobe HomeSite, GoLive, and Dreamweaver ( www.adobe.com), enable you to develop offline and then update the content on a remote server. file:///G|/1/0672328860/ch18lev1sec4.html (3 von 3) [19.12.2006 13:50:04] Troubleshooting Troubleshooting What happens if you upload all your files to the server and try to display your home page in your browser, and something goes wrong? Here's the first place to look. I Can't Access the Server If your browser can't even get to your server, this probably isn't a problem you can fix. Make sure that you have entered the right server name and that it's a complete hostname (usually ending in .com, . edu , .net, or some other common suffix). Make sure that you haven't mistyped your URL and that you're using the right protocol. If your webmaster told you that your URL included a port number, make sure that you're including that port number in the URL after the hostname. Also make sure that your network connection is working. Can you get to other URLs? Can you get to the top-level home page for the site itself? If none of these ideas solve the problem, perhaps your server is down or not responding. Call your webmaster to find out whether he or she can help. I Can't Access Files What if all your files are showing up as Not Found or Forbidden? First, check your URL. If you're using a URL with a directory name at the end, try using an actual filename at the end. Double-check the path to your files; remember that the path in the URL might be different from the path on the actual disk. Also, keep case sensitivity in mind. If your file is MyFile.html, make sure that you're not trying myfile.html or Myfile.html. If the URL appears to be correct, check the file permissions. On UNIX systems, all your directories should be world-executable and all your files should be world-readable. You can ensure that all the permissions are correct by using the following commands: chmod 755 filename chmod 755 directoryname Tip Most FTP clients will allow you to modify file and directory permissions remotely. I Can't Access Images You can get to your HTML files just fine, but all your images are coming up as icons or broken icons? First, make sure that the references to your images are correct. If you've used relative pathnames, you shouldn't have this problem. If you've used full pathnames or file URLs, the references to your images may have been broken when you moved the files to the server. (I warned you ) file:///G|/1/0672328860/ch18lev1sec5.html (1 von 2) [19.12.2006 13:50:04] Troubleshooting In some browsers, you get a pop-up menu when you select an image with the right mouse button (hold down the button on a Macintosh mouse). Choose the View This Image menu item to try to load the image directly. This will give you the URL of the image where the browser thinks it's supposed to be (which may not be where you think it's supposed to be). You can often track down strange relative pathname problems this way. If you're using Internet Explorer for Windows, you can also select the Properties option from the menu that appears when you right-click on an image to see its address. You can check the address that appears in the Properties dialog box to see whether it points to the appropriate location. If the references all look good and the images work just fine on your local system, the only other place a problem could have occurred is in transferring the files from one system to another. My Links Don't Work If your HTML and image files are working just fine but your links don't work, you most likely used pathnames for those links that applied only to your local system. For example, you might have used absolute pathnames or file URLs to refer to the files to which you're linking. As mentioned for images, if you used relative pathnames and avoided file URLs, you shouldn't have a problem. My Files Are Being Displayed Incorrectly Suppose you have an HTML file or a file in some multimedia format that's displayed correctly or links just fine on your local system. After you upload the file to the server and try to view it, the browser gives you gobbledygook. For example, it displays the HTML code itself instead of the HTML file, or it displays an image or multimedia file as text. This problem can happen in two cases. The first is that you're not using the right file extensions for your files. Make sure that you're using one of the correct file extensions with the correct uppercase and lowercase. The second case is that your server is not properly configured to handle your files. If all your HTML files have extensions of .htm, for example, your server might not understand that .htm is an HTML file. (Most modern servers do, but some older ones don't.) Or you might be using a newer form of media that your server doesn't understand. In either case, your server might be using some default content type for your files (usually text/ plain), which your browser probably can't handle. This can happen with server- side scripts as well. If you put up .php files on a server that doesn't support PHP, the server will often send the scripts to the browser as plain text. To fix this problem, you'll have to configure your server to handle the file extensions for the correct media. If you're working with someone else's server, you'll have to contact your webmaster and have him or her set up the server correctly. Your webmaster will need two types of information: the file extensions you're using and the content type you want him or her to return. If you don't know the content type you want, refer to Appendix E, "MIME Types and File Extensions." file:///G|/1/0672328860/ch18lev1sec5.html (2 von 2) [19.12.2006 13:50:04] Registering and Advertising Your Web Pages Registering and Advertising Your Web Pages To get people to visit your website, you need to promote it. The higher your site's visibility, the greater the number of hits. A hit is a visit to your website. Be aware that although your site may get, say, 50 hits in a day, that doesn't necessarily mean that it was visited by 50 different people. It's simply a record of the number of times a copy of your web page has been downloaded. There are many ways to promote your site. You can list it on major web directories and indexes, include the URL in your email signature, put the URL on your business cards, and so much more. The following sections describe each approach. Getting Links from Other Sites It doesn't take much surfing to figure out that the Web is huge. It seems like there's a site on every topic, and when it comes to popular topics, there may be hundreds or thousands of sites. Once you've done the hard work of creating an interesting site, the next step is to get other people to link to it. The direct approach often works best. Find other sites like your own and send a personal email to the people who run them introducing yourself and telling them that you have a site similar to theirs that they may be interested in. If they are, there's a good chance that they'll provide a link to your site. Oftentimes, there's a quid pro quo involved where you might link to someone else's site and ask them if they're interested in linking to yours in return. This doesn't mean that you should go out and pester people or email them repeatedly if they don't do as you request. The subtle approach often works best. If diplomacy isn't your strong suit, or even if it is, you might also want to look into some of the larger web directories as well. Many sites exist solely to direct users to other sites. Generally there's a process by which you can submit your site for inclusion in the directory. I'm going to discuss some of the larger directories individually but bear in mind that there are lots of other directories out there that are restricted to particular areas of interest. You should find the ones that are appropriate for your site and submit your URL to them as well. Yahoo! By far, the best-known directory of websites is Yahoo! at www.yahoo.com (see Figure 18.1), created by David Filo and Jerry Yang. This site started in April 1994 as a small, private list of David's and Jerry's favorite websites. Since then, it has become a highly regarded catalog and index of websites and is one of the most successful Internet companies out there. Figure 18.1. The Yahoo! site. [View full size image] file:///G|/1/0672328860/ch18lev1sec6.html (1 von 5) [19.12.2006 13:50:05] Registering and Advertising Your Web Pages Yahoo! uses an elegant multilevel catalog to organize all the sites it references. To view the contents of any level of the catalog, first you select the hyperlink for the major category that most closely represents the information you're interested in. Then follow the chain of associated pages to a list of related websites, like the one shown in Figure 18.2. The following is the full URL of this page: http://dir.yahoo.com/Computers_and_Internet/Data_Formats/HTML/ Figure 18.2. Yahoo's Announcement Services category. [View full size image] file:///G|/1/0672328860/ch18lev1sec6.html (2 von 5) [19.12.2006 13:50:05] Registering and Advertising Your Web Pages To add your site to Yahoo!, return to www.yahoo.com and select the category that's appropriate for your site. Work your way through any subcategories until you locate a list of sites that are most similar to your own. Suppose that you've created a site that discusses camel racing. You navigate your way through the Recreation links, which then leads to Sports, which then has a category called Camel Racing. Yes, there really is a category like this: http://dir.yahoo.com/Recreation/Sports/Camel_Racing/ When you scroll down to the bottom of this page, you see a Suggest a Site link. Click this link to display the Suggest a Site page. This page provides complete instructions for adding your site to Yahoo!. Currently, the process involves filling out four easy-tounderstand forms. Note Even though I'm discussing how to register for search engines individually, you may prefer to wait and register for them all at once. Later on in this lesson, I'll discuss some services you can use to do this. Caution These days, it can take an awfully long time to get your site into the Yahoo! directory. If you run a noncommercial site, you can submit your site for free and take your chances. If file:///G|/1/0672328860/ch18lev1sec6.html (3 von 5) [19.12.2006 13:50:05] . Organizing Your HTML Files for Publishing directory around to different servers without breaking the links. Having a Default Index File and Correct Filenames Web servers usually have a default index. username and password, and perhaps some other settings that you can leave alone if you're just getting started. Caution If you're sharing a computer with other people, you probably. pages on a remote web server. Microsoft's FrontPage is a web development tool aimed at small to medium websites. FrontPage provides a WYSIWYG page editor and a site manager for managing

Ngày đăng: 07/07/2014, 09:20

Xem thêm: Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition) P67 ppt