Within any Web site, there are patterns of functionality and presentation. For example, in the BOTS Consulting Web site, all press releases share a common design and feature set. If you were to take any press release within the site and remove all of the content that is, the information that any specific press release is trying to communicate you would end up with a basic framework upon which any press release can be built. If you were able to reuse this press release framework over and over, you would have in essence developed a basic template.
At a very basic level, a CMS template is a container. The template "contains" components contributed by a designer namely the visual design of the template and components that provide functionality contributed by a developer namely the code that a template may possess. Lastly, a template is a container of other containers containers that allow content contributors to enter content into the CMS repository. These containers are editable areas of the page called placeholders.
It's likely that you've built template-like HTML files or created systems that dynamically read data from a database and render it within a specific page design, so you may be familiar with the template concept. However, unlike homegrown systems that tend to be geared toward limited-use content entry and display, CMS templates are built based on a flexible framework that allows you to create very robust enterprise Web applications.
The biggest advantage of CMS templates is that they don't require you to code them to a specific scenario. Instead, templates in CMS are generally a collection of reusable components either provided by Microsoft or that you have created. Once the template is created, CMS provides an environment for content contributors to use that template to create pages (postings) within their site. The advantage is that your development and design efforts are limited to a relatively small number of templates. Yet these templates can yield literally thousands of pages within the site. Should you need to make a correction to the site or want to change the design, you simply change a few templates, and all pages based on those templates inherit the changes.
To illustrate our point, let's examine a page type within the BOTS Consulting Web site. For this example, we'll look at a press release (shown in Figure 12-1). You'll notice that you have several elements, such as the branding, the global navigation, the secondary navigation, and then all of the content. Drilling down further within the content, you'll notice that there's a title, a release date, the release itself, and a disclaimer. If you were to contribute a new press release to the BOTS site, you would use a press release template to create that new page. This template would define the design of your press release as well as what content belongs or doesn't belong in the release. Each element of content is entered into the placeholders, as defined by the template.
Figure 12-1. A typical press release in the BOTS Consulting Web site
Beyond the components already mentioned, the template also contains an administrative menu, called the edit console (also called the default console or just the console), which provides the interface to the content creation and management features in CMS. The edit console is provided by Microsoft and must be included in all templates that will be used by a content contributor. An excellent characteristic of the edit console is that it is "bright" enough to understand when it should display itself and when it should not. Further, it knows what authority a given user has, and displays only the functionality that user should have (we'll learn more about this when we discuss security). The sum total of all of these objects represents the template.
So, in short, we can think about a template as the framework for a given page. The framework controls the visual design elements, administrative functions, and sections where end users can enter content. Generically, then, we might refer to a template as a container, which holds all the elements that make up a page. In the BOTS site, for example, the press release template is a collection of objects and containers that define the design and the content structure for all pages based on the press release template.
Now, let's examine what the CMS template might look like when a user is contributing content.
In Figure 12-2 you'll notice that the look of the page has changed only slightly. Unfortunately, because of the size of the page, you can't see the edit console, but you can see the placeholders. Beyond that, you can see the branding image, the main navigation, and the side navigation. At the bottom (not shown), along with the disclaimer is a copy of the main navigation plus three links that take you home, to the site map, and to a login prompt. All these elements are part of the press release template.
Figure 12-2. The press release template in the BOTS Consulting Web site