Working with Server-Side Includes
Similar to library items, server-side includes (SSIs) allow you to create pieces of functionality that can be shared between various web pages and be edited and updated centrally. In some ways, you can consider server-side includes the predecessor to library items because server-side includes have been with us long before the inception of Dreameaver's library items. The major differences between the two, however, are that library items have a familiar editing interface (they can be directly modified, managed, and updated in Dreamweaver's development environment at design time) whereas the server handles the updating of server-side includes at runtime (when the files are actually processed by the server for viewing by the user). Furthermore, server-side includes can also include server variables such as the current date and time, the date on which the file was last saved, and even the size of a file as compared to a second file.NOTENot all servers support server-side includes because SSIs can pose a potential security risk. Check with your web hosting company before deciding to use server-side includes in your websites.At its foundation, server-side includes are used to include the contents of files within the scope of a second file, much like the way library items work. Typically, the code used to insert a server-side include resembles the following:
As you can see from the code, the standar214 opening and closing comment tag is used to wrap the server-side include directive. In this case, the directive is #include and contains the attribute file which specifies the document-relative file path to include in the web page. To include a file relative to the current site's root , the include changes to use the virtual attribute instead of the file attribute, as follows:
<! #inlcude file="footer" >
Of course, working with server-side includes in Dreamweaver is a snap because Dreamweaver's translator makes server-side includes visible during the design process. As long as the Show Contents of Included File check box (located in the Invisible Elements category of the Preferences window) is selected, as shown in Figure 16.10, server-side includes display in your pages in Dreamweaver without problems.
<! #inlcude virtual="/images/header.gif" >
Figure 16.10. Make sure that the Show Contents of Included File option is selected in the Preferences window.
[View full size image]

1. | Open a blan221 page by choosing the New option from the File menu. Choose th215 option from the Basic Page category and click Create. |
2. | Select the Server-Side Include option from the Insert menu. The Select File dialog appears. |
3. | Browse to the Library folder of the defined Dorknozzle site and choose the nav.lbi file. |
4. | Click OK. The navigation menu is included as a server-side include within the page. |
Switch to the Split Code/Design view and notice that the server-side include tag is added to the code.To edit the server-side include, select the server-side include and click the Edit button in the Properties Inspector. Dreamweaver immediately launches a new Document window instance for the LBI file.TIPIn our scenario, we used an existing LBI file as a server-side include. The beauty in server-side includes is that they're not limited to file extension types. For instance, you can use LBI, SSI, HTM, TXT, SHTML, ASP, ASPX, and more as included files.