Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Using Dynamic Web Templates (book excerpt)
 
Applies to
Microsoft Office FrontPage® 2003
Book cover This article was excerpted from Microsoft® Office FrontPage® 2003 Inside Out by Jim Buyens. Visit Microsoft Learning to buy this book. View other articles written by Jim Buyens.

This article was excerpted from Chapter 12, "Using Page Templates."

In this article

Understanding Dynamic Web Templates

Creating Dynamic Web Templates

Attaching Dynamic Web Templates

Maintaining Dynamic Web Templates


Understanding Dynamic Web Templates

Like static templates, Microsoft Office FrontPage 2003 Dynamic Web Templates impart new pages with a predesigned visual design and prepositioned page elements. Unlike static templates, however, Dynamic Web Templates remain attached to the pages they create. When you save changes to a Dynamic Web Template, FrontPage propagates them to each page in the same Web site that has that template attached.

The body of a Dynamic Web Template can contain any number of editable and non-editable regions. These designations, however, pertain only to pages that use a Dynamic Web Template. When you edit the template itself, you can edit either type of region. The following table illustrates this concept.

Region type Editable in template Editable in created page Propagates template changes
Editable Yes Yes No
Non-editable Yes No Yes

The preceding table also illustrates that only non-editable areas receive new content when you update the template. In effect, all copies of a non-editable region remain in sync with the template. If any copies of editable regions remain in sync, however, it's simply a happy accident.

Attaching a Dynamic Web Template dims most options on the General, Formatting, Advanced, and Language tabs of the Page Properties dialog box in the page to which the DWT is attached . It also dims the Style, Style Sheet Links, Shared Borders, and Background tabs on the Format menu. If you want to change these settings, modify the template, and let FrontPage update the attached pages. If this would affect more pages than you want, you probably need two Dynamic Web Templates — one for each set of appearance settings — instead of one.

 Note   One Dynamic Web Template can attach another. In this arrangement, changing the first template updates the one that attaches it, and this in turn updates any pages that use the second template.

Top of Page Top of Page


Creating Dynamic Web Templates

Before using a Dynamic Web Template you must, of course, create it. Here's the procedure:

  1. Open a new or an existing page in Design view.
  2. Add or modify any content you want.

     Tip   In a new Dynamic Web Template, the entire page is non-editable.

  3. Select the first area in the page that you want to designate as editable.

    If the area you want contains no other content, add an empty paragraph so that you can select it.

  4. Click Dynamic Web Template on the Format menu, and then click Manage Editable Regions.
  5. When the Editable Regions dialog box shown in the following illustration appears, choose a name for the new editable region and type it into the Region name box.

    Editable Regions dialog box

  6. Click Add to make the region part of the template, and then click Close to close the Editable Regions dialog box.

    An orange border surrounds the new editable region.

  7. Repeat steps 3 through 6 for each additional editable region.

You can create as many or as few editable regions as you want. Presumably you'll want at least one so that each page using the template can present its own unique content. At the same time, there's usually no advantage in creating lots of small editable regions that touch each other. A single, larger editable area would work just as well.

Here's the procedure for saving a Dynamic Web Template:

  1. Click Save As on the File menu.
  2. When the Save As dialog box appears, select Dynamic Web Template (*.dwt) in the Save As Type box.
  3. In the File Name box, type a short, easy-to-remember name — the same sort of name that you'd give any other Web page.
  4. Click Save to save the template and close the dialog box.

Top of Page Top of Page


Attaching Dynamic Web Templates

The procedure for using a Dynamic Web Template isn't difficult, but it does require a different approach than using static templates. Proceed as follows:

  1. Open the page you want the template to control.

    This could be a new, blank page or an existing page. If you like, you can create a new page based on a static template.

  2. On the Format menu, click Dynamic Web Template, and then click Attach Dynamic Web Template.
  3. When the Attach Dynamic Web Template dialog box shown in the following illustration appears, locate and double-click the template that you want to use.

    Attach Dynamic Web Template dialog box

  4. If your Web page has any existing content, FrontPage will display the large Choose Editable Regions For Content dialog box shown in the background in the following illustration. By default, this will associate the existing page content — designated (Body) — with the first editable region in the template.

    Choose Editable Region(s) for Content dialog boxes

    If, as in the preceding illustration, the page already uses a Dynamic Web Template and you attach a different one, FrontPage will try to match up editable regions in the old and new templates based on name. If an existing editable region name in the old template doesn't exist in the new template, FrontPage matches it up with the first editable region in the new template.

    If FrontPage doesn't propose the editable region matchups you want, select any line that's incorrect, and then click the Modify button. This displays the small Choose Editable Region For Content dialog box that appears in the foreground of the preceding illustration. Select the new region that you want from the drop-down list, and then click OK.

     Note   The doctitle editable region appears in the Choose Editable Region For Content dialog box by default. It designates the title of the Web page as editable. (This is the title that you enter in Design view after clicking Properties on the File menu.)

  5. Click OK to close the dialog box and apply the template.

    FrontPage will display the dialog box shown in the following illustration to confirm the operation.

    Confirmation dialog box

  6. To save the updated Web page, click Save on the File menu.

Designating a Dynamic Web Template region as non-editable is no cure-all. In pages that attach the template, designers can modify non-editable regions in Code view, or by opening the page in any editor other than Design view. However, FrontPage will discard such changes the next time it propagates changes from the template.

Top of Page Top of Page


Maintaining Dynamic Web Templates

When you edit and save a Dynamic Web Template, FrontPage displays a confirmation prompt similar to the one in the following illustration.

Confirmation prompt

If you click Yes, FrontPage will propagate your template changes to each attached page. If you click No, FrontPage will bypass the updates. Clicking No might be useful if you're saving the template to guard against loss of work, and not because the changes are complete.

The following commands apply to any Dynamic Web Templates that you open in Design view. To access them, point to Dynamic Web Template on the Format menu.

  • Update Selected Page   Propagates template changes to the selected pages.
  • Update All Pages   Propagates template changes to all pages.
  • Update Attached Pages   Propagates template changes to all pages attached to the current template.

On the flip side, FrontPage provides the following commands whenever a page attached to a Dynamic Web Template is open in Design view. To access these commands, click Dynamic Web Template on the Format menu.

  • Detach From Dynamic Web Template   Disconnects the current page from the template, but leaves the template's content in place (and now editable).
  • Open Attached Dynamic Web Template   Opens the template file for editing.
  • Update Selected Page   Propagates template changes to the current page.

Dynamic Web Templates are a very powerful new feature of FrontPage 2003 — so powerful that many Web designers will likely adopt them in preference to themes, static templates, and include files for reusable layouts such as page headers and footers.

Top of Page Top of Page


About the author   Jim Buyens is a FrontPage, Web programming, and networking expert who has written several books, including Microsoft® FrontPage® Version 2002 Inside Out, Web Database Development Step by Step .NET Edition, Faster Smarter Beginning Programming, and Microsoft® Windows® SharePoint® Services Inside Out, all from Microsoft Press. Jim is a Microsoft Most Valuable Professional (MVP) who contributes extensively to the Microsoft FrontPage online communities. He currently develops Web-based business systems for the telecommunications industry.

© 2009 Microsoft Corporation. All rights reserved.