5.4 Server-Side Includes

A server-side include (SSI) tells the web server to include the contents of another file before sending the requested document back to the user 's browser. Although it is difficult to preview SSIs with a browser, Dreamweaver mimics the server and includes the chosen document in your HTML document.

To add an SSI to a document, use Insert figs/u2192.gif Server-Side Include.

In the Select File dialog box that appears, select the document containing the server-side include. This document could be a .map file for a server-side image map or any other file used for a server-directed process affecting the HTML document served to the user's browser. It can even be another file containing HTML, provided that it doesn't contain <head> or <body> tags.

If the included document contains valid HTML code, the resulting page will be viewable in Dreamweaver's Document window as well. However, server-side includes appear in the Code pane as HTML comments, as shown here:

 <!--#include virtual="/calendar.map" --> 

Therefore, to select a SSI, you can select the comment placeholder, as seen in Figure 5-17. When the SSI is selected in the Document window, you can set its properties in the Property inspector, also shown in Figure 5-17.

Figure 5-17. The Property inspector for server-side includes

In the Property inspector, set the Type field to Virtual if using an Apache Web Server. Set the Type to File if using a Microsoft IIS server. See "Using Server-Side Includes" in the Dreamweaver Help for more details. You can edit the included file by clicking the Edit button in the Property inspector.

HTML documents containing server-side includes must be saved with the .shtml or .shtm file extension; otherwise , the server may not process included files.

In Part I of this book, you have seen how to use Dreamweaver to create documents and insert objects into a web page. In Part IIyou'll see how to use Dreamweaver to manage sites and documents and learn to use templates, library functions, and stylesheets.

Dreamweaver in a Nutshell
Dreamweaver in a Nutshell
Year: 2005
Pages: 208

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net