Applying or replacing page templates to Web pages

You can take an existing page with no connection to a page template and apply a page template to it. You can also replace a page template on a page that has an existing connection to a different page template.

  1. Create a Web project.

  2. Create new Web pages.

To apply a page template or to replace an existing page template:

  1. Open the page in Page Designer.

  2. From the main menu, click

    Page | Page Template. Then choose one of the following menu options:

    • Apply Template - Choose this option if you are editing a page that has no connection to a page template and you want to apply a page template to the page. The "Apply Page Template" wizard appears.

    • Replace Template - Choose this option if you are editing a page that has a connection to a page template and you want to replace the page template with a different template. The "Replace Page Template" wizard appears.

  3. If you choose

    Apply Template, the "Apply Page Template" wizard appears.

    1. Select a template that you have already created in the "My Templates" folder or select a template from "Samples Template" folder. Also select the template type if applicable. There are two types of templates: design-time page templates and dynamic page templates.

    2. Click Next. The "Map Page Elements to the Page Template" page of the wizard appears in which you specify how the page template should display the page contents. The source for the content areas are defined in the "page template content areas" list. The elements for the Web page that you select on the previous wizard page display in the page elements list. When you apply a page template to an existing Web page, the page template is like a page that is placed on top of the existing page, and the content areas are like windows that display content from the original page. By doing this mapping, you are defining what content from the original page should be displayed in which content area.

    3. In the Page template content areas list, select the content area that you want to map to a page element.

    4. In the Page elements list, select the element to which you want to map the content area.

    5. Then click the

      Map button. Do this for each of the content areas.

      This associates the content areas in the page template with elements in your Web page. For example, if you select one of the sample page templates, a headarea and a bodyarea content area are predefined. You can select the headarea content area and associate it with the HEAD (anything between the start and end HEAD tags). Any attributes defined in the page template for the headarea content area are applied to the HEAD region of the existing Web page. The preview boxes display the current page and a preview of what the page will look like once the template is applied. If some area of the original page is not mapped to a content area, it will not be included in the page after the template is applied.

    6. To remove a mapping, select the element in the Page elements list and click the

      Unmap button.

    7. If you selected a dynamic page template, you can optionally select Next, which displays the "Specify Content Area File Name" page of the wizard. Use this page to specify new or existing fragment files with which to fill a content area.

    8. Click Finish to apply the change to the template.

  4. If you choose

    Replace Template, the "Replace Page Template" wizard appears.

    1. Select a template that you want to replace the current template with, and select the template type if applicable.. There are two types of templates: design-time page templates and dynamic page templates.

    2. Click Next. The "Map Content Areas" page of the wizard appears.

    3. Specify mappings between

      Current Content Area Name and the

      New Target Content Area Name. Click the names in

      New Target Content Area Name to make changes. Previews of the page with the current template and the replaced template are displayed.

    4. If you selected a dynamic page template, you can optionally select Next, which displays the "Specify Content Area File Name" page of the wizard. Use this page to specify new or existing fragment files with which to fill a content area.

    5. Click Finish to apply the template changes to the page.

You can now make any additional changes to the content areas of the page in Page Designer. Areas outside the content areas are defined by the page template and can only be changed in the page template. You can double-click these areas to open the page template. Any changes made to the page template will automatically be updated in the page.

Restriction: There are several circumstances that can cause a page template to not be applied to a Web page when using any of the page template wizards:

Note: The properties of a content area may be limited by where the content area is defined in the template. It is not recommended to define a content area inside <P> or <SPAN> tags because you may have difficulty formatting text or adding styles to the content area from the page that uses the template. For example, if a content area is defined within a <P> tag, you won't be able to change the text in the content area to H1, or if the content area is within a <FONT> tag, you won't be able to modify the font properties of the content area. If you are going to apply several styles or paragraph types to a content area, it is recommended to insert a content area inside the <BODY> tags of the page template or <TD> tags if the page template is using tables or free layout tables for layout.

 

Related concepts

Page templates

Design-time page templates and dynamic page templates

Nested page templates

 

Related tasks

Creating a Web page template

Laying out a page template with tables

Generating Web pages from page templates

Applying a page template to a Web site

Adding content to a page template

Creating a nested page template