O'Reilly logo

Web Design All-in-One for Dummies® by Sue Jenkins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9: Building Web Sites
In This Chapter
Understanding the benefits of using templates
Creating and using templates
Working with Server-Side Includes
Understanding site-root and document relative paths
Comparing templates and SSIs
A
t this stage, you’ve probably already designed your mock-up for the
site, optimized all the graphics, and chosen how to lay out your pages
using layers and tables, and you have a basic understanding about how to
style the content with CSS. The next step you take in building your Web site
is to create a master page from which you generate all the other pages on
the site. Though each page will have different content, the general layout for
every page will likely be the same, with the logo, navigation, and other ele-
ments in the same location throughout the site. While it really doesn’t
matter which page you decide to use to build the site’s master page, the
home page is usually a good choice, unless for some reason it’s drastically
different in look and layout from the rest of the site.
Saving time, eliminating busywork, and leveraging browser
(and ISP) caching to improve the speed of your site are
three of the main reasons why you use a master page to
build your site. A fourth reason has to do with manag-
ing future site updates after your site is finished. In
particular, you have two site-construction solutions
for the nondynamic Web site that work beautifully:
templates and Server-Side Includes, or simply SSIs.
These tools, whether used singly or in conjunction
with one another, enable you to change every page
on a site simply by making the changes once to your
master page or master SSI.
In this chapter, you find an overview about working with
templates and Server-Side Includes. Both techniques,
which work in markedly different ways and are suited for dif-
ferent purposes, can help you make global updates to a site with the
least amount of effort. In addition, this chapter shows you how to work with
both methods, plus gives you a comparison chart to assist you in determin-
ing which solution will work best for any site you happen to create.
22_417966-bk03ch09.qxp 3/25/09 10:40 PM Page 459
Building the Master Page
460
Building the Master Page
To build this master page, you should have certain tools at your disposal so
that starting a new page with the master requires the least amount of redun-
dant work. You also want a master file that enables you to quickly and effi-
ciently make updates to the pages at a later time. You might not think you
need to consider site updates until after you build the site, but in fact the
projected frequency of the updates can be a major determinant for how you
create the site’s pages from the start.
Whichever page on your site you choose to develop, your master page
should include all the features that are common to all pages on the site. For
instance, if a navigation bar appears across the top of the layout and a set of
footer links appears across the bottom of the pages, the code for these ele-
ments will not need to be rebuilt for each of the remaining pages on the site.
For that matter, even copying and pasting the code from one page to
another is too much work.
The two most effective ways for creating a master site page and building
your site are templates and SSIs, which are described in the remaining sec-
tions of this chapter. Both methods enable you to make site-wide changes
quickly and efficiently.
When you build a master page from the site’s home page, an added benefit
is that it can provide your clients with a peek into the site-building process
and get them even more excited about seeing the finished product. It also
gives them an opportunity to review a sample HTML page for layout accu-
racy and functionality. That way, should the client raise any issues regard-
ing the layout or navigation, you can correct those concerns before
generating any of the other pages on the site.
Building Web Sites with Templates
If you’re using a code editor like Adobe Dreamweaver or Microsoft
Expression Web, your application probably contains some kind of system
for creating and using templates. A template not only establishes visual con-
sistency between the pages but can also significantly reduce the time it
takes to build the rest of the pages on the site and make changes to those
pages anytime the site needs global modifications, both during the site-
building process and for any postlaunch site maintenance.
Templates are a great solution for most small- to medium-sized Web sites
(under about 30 pages) that use little to no dynamic capabilities because
22_417966-bk03ch09.qxp 3/25/09 10:40 PM Page 460

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required