Template

Digest

template A Template is a fundamental system entity that defines the HTML/XML structure of page asset in the CMS.  Templates are essentially XHTML documents that contain standard HTML tags and CSS that create what is commonly referred to as the "look and feel" of a web page.

Concept

More Insight into Templates

In addition to the normal HTML elements, templates also allow for special system tags to be embedded that define the content regions of the document. These content regions are the areas where new blocks of content can be placed in a "building block" manner to create a resulting XHTML web page. Likewise, XSLT stylesheets can also be applied to these regions against a block asset to create XHTML content as well.

Once a template has been created in the system, a user may choose to the edit the template again where they will be presented with an interface to perform these block/stylesheet assignments to the various regions that might be available in the particular template. Each region is designated by a special HTML comment tag or XML tag where MY-REGION-NAME is replaced with the name of the region. An important note to consider is that all templates must contain a region called DEFAULT where a page's "default" content will appear from the data that the end user enters into the editing environment for a page that inherits the template. If a DEFAULT region has not been created, the system will automatically create the region immediately after the opening <body> tag of the template document.

Template System Regions

In order to insert content into a template, users must add System Regions. These regions are written into the template to indicate to the system where to place various content blocks.

The most important region to include in a template is the default region. Wherever on the template you wish the default content to be placed (typically just below the header), type it in. When a page is edited and content is added, it is placed into this default region.

Other regions can be specified by simply adding code into the template wherever users wish regions to appear. Users may name regions anything they like, but it's best to be descriptive. Typical regions include FOOTER, HEADER, BREAD-CRUMBS, LEFT-NAV, RIGHT-NAV, etc.

Assigning at the Template Level

The template is at the lowest level of the hierarchy. Assignments made at this level will carry over to the configuration set that inherits them.

If assigned regions are not meant to change from page to page within the site, they should be assigned at the template level.

Example:

Header and Footer blocks will be the same across all pages, regardless of the configuration sets they use. As long as all pages use configuration sets based on that template, those Header and Footer blocks will carry over with them.

To learn more about how to assign at the template level, please continue on below to our "Technical" section.

Technical

Creating Standards Compliant Templates

All templates must adhere to the standards that define well-formed XML documents. This includes, but is not limited to, maintaining lowercase tag names (i.e. <P> becomes <p>) and always appending opening tags with their closing tag counterparts (i.e. <p> cannot be left alone and must have an ending </p> tag after the paragraph content) unless the document type definition allows for the tag to be self-closing (i.e. <img xsrc="/cms/render/file.act?path=/myImage.jpg> becomes <img xsrc="myImage.jpg/> with the closing slash. Documents that are not well-formed can be passed through an optional XHTML filter that will perform a conversion of the document structure to adhere to the XHTML standard.

For more information about well-formed XHTML documents, consult the W3C website below:

http://www.w3.org/TR/xhtml1/

Creating a Template

To create a new template:

  1. Determine where you want to store the new template, and select the folder from the left asset tree. Typically, templates are reused for many pages and are stored in a central or common folder.

  2. Once in the desired folder, use the top navigation menu and select New-> Default-> Template.

newd
  1. On the Content pane:
    Type, or copy and paste, in the HTML for your template.
    The convert HTML to XHTML checkbox, here, if checked, will attempt to convert markup into XHTML compliant markup. Note that no special Dreamweaver template markup is recognized in this scenario. When importing a Dreamweaver template into Cascade Server, it is encouraged to use Import Dreamweaver Template (Tools -> Import -> Dreamweaver Template).

  2. On the Regions pane:
    If there are already system regions set up in your template, you will see these listed here. For each region listed, you may select a default block and stylesheet. These selections may be overridden at the configuration and page levels.

  3. On the System pane:
             Name
    - Type in a name for your template.
             Parent Folder
    - By default, this will be the current folder, however, this can be overridden

Assigning at the Template Level

How to Assign at the Template level: 
  1. Select your template from the left asset tree, and click Edit.
  2. All of the currently defined regions appear, including file chooser icons to select blocks and stylesheets for each region.
  3. To assign a block or stylesheet, click on the appropriate file chooser icon, and select the desired block or stylesheet from the pop-up asset menu.
  4. Click Submit to save your changes. These assignations will be replicated throughout any page based on this template, but can be overridden at any stage.

All pages are based on templates, which provide the HTML structure for the page.

Populating Template Regions with Blocks and Stylesheets

Once you have created your regions, you can populate them with blocks and stylesheets at the template level. Populating your regions at the template level is useful when certain blocks and stylesheets are to be used on multiple pages based on that template.

To assign blocks and stylesheets:

  1. Click Edit on the desired template, and go to the Regions tab.
  2. For each region you wish to populate, select a block and/or stylesheet from the choosers.

  3. Click Submit to save your changes.

Assignments made at the template level are optional and may be overridden at the configuration or page levels.

crtemp


Related Links