Using Server-Side Includes

Even if you don’t want to dive into the weird (but wonderful) world of server-side programming, you can still take advantage of one timesaving featured that dynamic web pages offer: server-side includes (SSIs). SSIs are like the Dreamweaver Library items discussed in Chapter 18; they’re individual files with code that you can reuse on pages throughout a site. They’re great for banners, footers, copyright notices, sidebars, and other chunks of HTML you use throughout a site. For example, you might use the same banner (logo, navigation bar, search box, and so on) at the top of each page. Instead of replicating that HTML over and over again, you can store it in a single file and “include” that file on your site’s pages.

The advantage to this approach is that if you need to change anything on the banner, you open its file, make the change, save it, upload it to your web server, and voilà, your site is updated. Server-side includes actually make site updates easier than Library items. As you can read on Editing Library Items, when you make a change to a Library item, Dreamweaver has to update all the relevant pages on your site: granted, that process is fast and automated, but it still requires that you upload all the changed files to your web server—and if the Library item appears on 10,000 pages, you have to update and upload 10,000 pages! That takes time.

Web servers incorporate server-side includes into a web page on the fly, when a visitor requests the page. ...

Get Dreamweaver CS6: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.