Chapter 10. Multipart Pages
As you start to build bigger and more elaborate Web sites, you’ll no doubt discover one of the royal pains of Web site design: getting a common ingredient to appear on every page.
For example, you might decide to add a menu of links that lets visitors jump from one section of your site to another. You can place these links in a table or a <div> element (two techniques shown in Chapter 9) to get them in the right position on a page, but either way there’s a problem—you need to do a fair bit of copying and pasting to display the menu on every page of your site. If you’re not careful, one page can end up with a slightly different version of the same menu. And when you decide to make a change to the menu, you’ll face the nightmare of updating every one of your pages. Web creators who try this approach don’t get out much on the weekend.
There’s no simple solution to this problem, but crafty Web designers can use a variety of techniques to get around it:
Server-side includes. A server-side include is a command that injects the contents of one XHTML file inside another. This lets you carefully separate a block of XHTML content (for example, a menu) and reuse it in multiple pages. However, there’s a significant caveat—the XHTML standard doesn’t support server-side includes on its own, so you can use this feature only if you have the right type of Web server.
Frames. Frames are a sometimes-controversial XHTML feature that let you display more than one Web page in ...
Get Creating a Web Site: The Missing Manual, 2nd Edition 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.