Creating a page template

Show Me

You can use page templates to define the look and feel of your Web site. If you make changes to the page template, the pages created from that page template are automatically updated.

You can create a page template in two ways:

  1. To create a brand new page template:

    1. Choose File > New > Other > Web > Page Template File. The New Page Template File wizard opens.

    2. Name the file and choose a folder for the file.

    3. In the Markup Language field, choose either HTML or XHTML as the markup language.

    4. In the Model field, choose a model for the template. Depending on where you will use the template, choose to create a blank template containing HTML, JSP, or Faces components.

    5. Select the Configure advanced options check box if you want to make further refinements to the template (for example, adding tag libraries or style sheet information).

    6. Click Finish. The new page template is created and is ready to be edited.

    7. Add elements to the newly created page template. The common area is the part of the template that appears in each page that uses the template. The entire template is a common area by default; once you add a content area, the common area is the area surrounding the content area. Here are several ways to add elements to the common area of the page:

      • Enter text directly on the page and change attributes as needed.

      • Drag and drop components from the palette. The choices on the palette differ depending on what kind of page template you created. For example, if you have created a Faces components page template, you can drag and drop components from the Faces components drawer on the palette.

      • Open the Page Template drawer on the palette and drag and drop a page fragment to the page. A page fragment lets you include part of a page from another file (similar to an SSI include or a JSP include). Changes in the page fragment are also applied immediately to all the pages created from the template.

    8. Add a content area to the newly created page template. A content area is the section of the page that is filled in later by the pages that use the template. When you create a page from the template, the content area is editable, and the common area is fixed. Note that a page template must contain at least one content area. To add a content area:

      1. Open the Page Template drawer on the palette.

        Picture of the Page Template drawer on the Palette

      2. Drag a Content area component and drop it to the page.

      3. When prompted, name the content area and click OK.

    9. Choose File > Save and select the folder in which to save the template file. Now, you are ready to use the page template to create other new pages.

  2. To create a page template from an existing file:

    1. In Page Designer, open the existing HTML or JSP file that you want to be a page template.

    2. Make sure to insert a content area in the appropriate position on the page. To create a content area, open the Page Template drawer on the palette, drag and drop a content area to the page, and then add content to the content area.

    3. Select File > Save as Page Template

 

Related concepts

Page templates

 

Related tasks

Laying out a page template with tables
Generating Web pages from page templates
Applying or replacing page templates
Applying a page template to a Web site
Adding content to a page template
Nesting page templates