Microsoft Expression Web For Dummies
After you create and save a Dynamic Web Template in your site, you attach it to a regular Web page. (We call this regular page the content page.) The content page you choose can be full of text and graphics, or it can be empty. Either way, after you attach a Dynamic Web Template to the content page, all the elements in the template appear automatically inside the content page.
REMEMBER | If your page contains content, Expression Web can put the existing content into only one editable region, even if your Dynamic Web Template contains several editable regions. Be sure to read these instructions carefully and thoroughly because some of the steps can seem a bit confusing. |
To attach a Dynamic Web Template to a content page, follow these steps:
-
Open (or create) the content page to which you want to attach the Dynamic Web Template.
Figure 11-4 illustrates a simple content page. This page contains only text, but keep in mind that content pages can contain anything, from text and pictures to tables, form fields, and anything else a Web page can hold. Content pages can also start out empty.
Figure 11-4: A typical content page. -
In the Folder List task pane, click to select the icon for the page you want to attach the Dynamic Web Template to.
If you want to attach the Dynamic Web Template to multiple Web pages, hold down the Ctrl key and click each page.
-
Choose Format
Dynamic Web Template Attach Dynamic Web Template. The Attach Dynamic Web Template dialog box appears.
-
Click the filename for the Dynamic Web Template and then click Open.
If the page or pages you're attaching the template to contain content, a message warns you that content outside the <html> tag will be erased. Because your content is safely nested inside the page's <html> tags, click Yes.
Keep these considerations in mind when you attach the Dynamic Web Template:
-
If the content page is empty, the elements inside the Dynamic Web Template appear inside the content page automatically.
-
The filename of the attached template appears in the upper-right corner of the page. (This notation is only a reminder for you; it doesn't appear when the page is viewed with a Web browser.) Also, the cursor blinks inside the content page's editable region (the first region in the page if the page has more than one), prompting you to add some content to the page. Do so by typing some text, adding a graphic, or inserting whatever content you want. (You can skip the rest of the steps in this section.)
-
If the content page already contains text, graphics, or other content, the Match Editable Regions dialog box appears, as shown in Figure 11-5.
Figure 11-5: The Match Editable Regions dialog box. -
The first time you attach a Dynamic Web Template to a content page, you must tell Expression Web which editable region should hold the page's existing content (even if the page contains only a single editable region).
-
The Dynamic Web Template column lists the name of the first (or only) editable region in the page.
-
The Current Page column lists Expression Web's best guess about which existing content on the content page should be placed in the editable region displayed in the Dynamic Web Template column.
-
-
Choose an editable region to hold the page's existing content by clicking that region's name in the dialog box.
REMEMBER Existing content can be funneled only into a single editable region, even if the template contains more than one region.
If you're happy with the Expression Web default choice (the first editable region in the template), or if the template contains only one editable region, click OK. The Match Editable Regions dialog box closes, and a Microsoft Expression Web dialog box appears, confirming that the content page has been updated. (Click the Close button to close the dialog box.) You're done!
If you're not happy with the default choice, read on.
-
In the main area of the Match Editable Regions dialog box, click the name of the editable region you want to change, and then click the Modify button.
The Choose Editable Region for Content dialog box appears.
-
From the New Region list box, choose the name of the region you want, and then click OK.
The Choose Editable Region for Content dialog box closes, and the Match Editable Regions dialog box becomes visible again.
-
In the dialog box, click OK.
The Match Editable Regions dialog box closes, and a Microsoft Expression Web dialog box appears, confirming that the content page has been updated. (Click the Close button to close the dialog box.) The finished page appears, as shown in Figure 11-6.
Figure 11-6: How the content page looks with the Dynamic Web Template attached.
You can attach the same Dynamic Web Template to as many content pages in your site as you like. The more pages you format by using the templates, the more pages you don't later have to edit by hand when you simply want to change a single element that appears in all the pages (such as a new logo, a page banner, or an updated copyright notice).
GLANCE AT THE CODE | After you attach a Dynamic Web Template to a page, Expression Web inserts a comment with the template name near the top of the page, like this: <!-- #BeginTemplate "pianotuners.dwt" --> |
An ending comment is inserted at the bottom of the page:
<!-- #EndTemplate -->
Other than that, the code for a page with a Dynamic Web Template attached looks almost exactly like the code for the Dynamic Web Template, except that the page's unique content, rather than the placeholder text, appears between the comments. All non-editable regions (the fixed content areas from the Dynamic Web Template) have a light orange background. Here's what the first line or two of our content page example looks like:
<!-- #BeginEditable "Page%20Content" --><h2>We want your music to sound great. Always!</h2> <para>A well-tuned piano fills your home with music...</para> <!-- #EndEditable -->
REMEMBER | After you attach a Dynamic Web Template to a content page, you can type or insert content only into the page's editable regions; the rest of the page is "locked." If this isn't okay, and you need to make a change to a part of the page that lies outside an editable region, you can either detach the content page from the Dynamic Web Template (making the entire page editable) or add more editable regions to the attached template and then save the template's changes (automatically updating any attached pages). We explain how to update a site based on Dynamic Web Templates in the next section. |
Here are a few considerations to keep in mind when working with Dynamic Web Templates:
-
When a page with a Dynamic Web Template attached to it is open in the editing window, Expression Web shows you what you can and cannot edit by graying out the fixed, "locked" content in Design view. Also, when you pass your cursor over one of these regions, it changes to a circle with a slash through it. If elements in the non-editable region have a light background color, this highlighting makes them look different in Design view (for example, white turns gray). To see what your page will look like to your Web visitors, preview it in a browser. (We tell you how in Chapter 2.) In Code view, locked code is highlighted in light orange. -
You can combine the power of Dynamic Web Templates and Cascading Style Sheets in your Web site by attaching an external style sheet containing all positioning and formatting to the Dynamic Web Template. Not only do your content pages contain the fixed content from the Dynamic Web Template, they also already have the style sheet attached. All the Web site templates provided with Expression Web use style sheets and Dynamic Web Templates in this combination. Create a new Web site from your favorite Expression Web template (we tell you how in Chapter 1) and take a look around to see how the different pieces fit together.
-
Although Dynamic Web Templates are powerful creatures, they don't play well with each other. Each page can have only one Dynamic Web Template attached to it at a time.