|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
You need to change the following directives to enable SSI on NCSA or Apache servers:
Learning to find the configuration files for your server, and to use the Options and AddType directives, is all you need to do to edit the configuration files. Enabling SSI on Windows NT machines is usually a matter of naming your HTML files correctly and clicking a check box somewhere in the Configuration dialog box. Process Softwares Purveyor server uses .htp as the default filename extension for parsed files. Most other servers emulate NCSA and use .shtml instead. However, changing the extension is usually simple. Hunt up the MIME Types dialog box and add a MIME type of text/x-server-parsed for whichever filename extension you want. (As always, check your particular servers documentation to find out whether this technique works.) One last note on configuration: most servers allow you either to require that all SSI executables be located in your cgi-bin or Scripts directory, or require this by default. If your server doesnt require this behavior by default, find the documentation to learn how to enable it. If the only programs that can be run are located in a known, controlled directory, the chances for errors (and hacking) are greatly reduced. Using SSI in HTMLNow that youve enabled SSI on your server (or talked your system administrator into doing it for you), youre ready to learn how to use SSI. Sit back and relax a bit. What youve done already is by far the hardest part. From here on, you simply need to find the syntax in your particular servers documentation and try things out.
Having embedded commands makes it easy to implement SSI while still making the HTML portable. A server that doesnt understand SSI passes the commands to the browser, and the browser ignores them because theyre formatted as comments. A server that does understand SSI, however, does not pass the commands to the browser. Instead, the server parses the HTML from the top down, executing each comment-embedded command and replacing the comment with the output of the command. This process is not as complicated as it sounds. You will go through some step-by-step examples later in this chapter, but first youll examine HTML comments. HTML Comment SyntaxBecause anything not tagged in HTML is considered displayable text, comments must be tagged like any other directive. Tags are always marked with angle bracketsthe less-than sign (<) and greater-than sign (>)and a keyword, which may be as short as a single letter. For example, the familiar paragraph tag, <p>, is empty, so no closing tag is necessary. Nonempty tags, such as <A href...>...</a>, enclose displayable information, or content, between the opening and closing tags. The comment tag is empty and is of the form: <!--comment text here-->
In summary, an HTML comment is anything with the format <!--commenttexthere-->. Browsers know to ignore this information, and servers dont even see it unless SSI is enabled. Turning Comments into CommandsWhat happens to comments when SSI is enabled? The server looks for comments and examines the text inside them for commands. The server distinguishes comments that are really SSI commands from comments that are just comments by following a simple convention: inside the comment, all SSI commands start with a pound sign (#). All SSI commands therefore begin with <!--#, followed by information meaningful to your server. Typically, each server supports a list of keywords, and it expects to find one of these keywords immediately following the pound sign. After the keyword are any parameters for the commandwith syntax that varies both by command and by serverand then the standard comment closing (-->).
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |