5.1. Adding server-side includes
Dreamweaver has made inserting a server-side include
in your Web page straightforward. You can use a Dreamweaver object to
easily select and bring in the files to be included. Any other type of
SSI, such as declaring a variable, must be entered by hand, but you can
use the Comment object to do so without opening the Code view.
To use server-side includes to incorporate a file, follow these steps:
In the Document window, place your cursor at the location where you would like to add the server-side include.
Choose Insert Server-Side Include or choose Script:SSI from the Insert panel's HTML category. The standard Select File dialog box appears.
In
the Select File dialog box, type the URL of the HTML page you would
like to include in the File Name text box or use the Browse button to
locate the file. Click OK when you're finished.
NOTE
Through the Select File dialog box, you can also
select a data source for a dynamically inserted SSI or link to an SSI
already published on a server through the Sites and Servers interface.
However, SSIs inserted in this manner can be previewed in Dreamweaver
only in the Live Data view.
Dreamweaver displays the contents of the HTML
file at the desired location in your page. Should the Properties panel
be available, the SSI Properties panel is displayed (see Figure 6).
In
the Properties panel, if the server-side include calls a file-relative
document path, select the Type File option. Alternatively, if the SSI
calls a site-root–relative file, choose the Type Virtual option.
5.2. Editing server-side includes
As is the case with Library items, you cannot
directly edit files that have been inserted into a Web page using
server-side includes. In fact, should you try, the entire text block
highlights as one. The code for a server-side–included file is quickly
accessible through the Related Files bar.
To edit the contents of the server-side–included file, follow these steps:
From the Related Files bar, choose the server-side file you want to edit.
If you want to see changes applied to the design, enter Live View.
Make any changes desired to the code.
Choose Source from the Related Files bar.
If you're in Live View, the changes will now be displayed.
Another, older way to edit your SSI is to select it
and then click the Edit button in the Properties panel. The file will
open in a new Dreamweaver window for editing. Save your file and then
switch back to your source file to see the changes. Although this
technique still works, using the Related Files bar with Live View is
much faster.
Unlike when you are editing Library items,
Dreamweaver does not ask if any other linked files should be updated
because all blending of regular HTML and SSIs happens at runtime or
when the file is open in Dreamweaver and the SSI translator is engaged.