Chapter 3

Capitalizing on Expression Web 4 Template Options

This page serves as the companion web page for Chapter 3 of Expression Web 4 Step by Step.

The term "template” has a number of definitions. Even within the confines of Web design and development the term can mean different things to different people. For instance, Expression Web has a number of Web Site Templates. These are basically generic sites, complete with navigation and uniform page layout. The individual pages of these Site Templates are also based on templates, in this case, Dynamic Web Templates.

Besides the Web Site Templates and Dynamic Web Templates, Expression Web users can easily make use of a template system inherent to ASP.NET, called ASP.NET Master Pages.

Expression Web also provides the ability to make a template from a just a part of a page. For example, to put a news box, RSS feed, advertising content, or some other content on some pages but not all, a designer can create an ASP.NET User Control or a file that Expression Web will include on pages as a PHP Include File. Expression Web even has an include file method that happens locally, like the Dynamic Web Template, so designers can use the Include Page feature without having to consider the server environment.

All this template functionality serves a larger purpose: maintaining uniformity across multiple pages. Prominent side benefits of templates include greatly easing the work of maintaining, managing, and even designing a site.

After completing this chapter, you will be able to:

  • Understand template concepts
  • Use Dynamic Web Templates
  • Use the Include Page feature
  • Use ASP.NET master pages
  • Use ASP.NET Web user controls
  • Use PHP include files

Understanding template concepts

To incorporate template techniques into your work, it’s important to see them in action and understand how each kind of template yields tangible results in your design and development workflow. In Expression Web the available template methods can be divided into two categories: Run Time and Design Time.

Expression Web’s Design Time templating functionality, which includes Dynamic Web Templates and the Include Page, takes place on the local computer inside the Expression Web environment, and results in complete files that are published to a server. These Design Time methods are handy because they are totally independent of any server requirements. If the server can pass HTM/HTML files to a browser, Expression Web’s Design Time features will work.

In contrast, Run Time templating features, such as ASP.NET Master Pages, ASP.NET Web User Controls, PHP Include files, and other server-side includes, all have special requirements that the server must meet—or they won’t work.

Expression Web 4 lets you work with Run Time features through the Expression Development Server. If you have designed a page that leverages server-side features such as ASP.NET or PHP, Expression Web will display the files in WYSIWYG format, and even run those pages in the Expression Development Server when you preview them from within Expression Web—regardless of where the files are located on your computer.

Using Dynamic Web Templates

A DWT is a good way to template a Web site because all the "work” of combining the template file and the content files occurs locally on the designer’s computer while still letting you see many of the same results produced by server-side. DWTs let you control the layout and global elements of multiple pages from one centralized template file.

In this chapter segment you will work with Dynamic Web Templates in a number of different ways

Expression Web 4 Dynamic Web Template

Using the Include Page Feature

While Dynamic Web Templates are obviously designed to be used as a page layout tool, sometimes a designer should use an include file. Since the Expression Web Include Page functions like the Dynamic Web Template: at Design Time, a designer can use it regardless of their server environment. By putting advertising code, RSS feeds code, or any other piece of content that the designer wants to be able to include on multiple pages, yet not be locked into having it on all pages as they would with a DWT, the Include Page is a good choice. While Dynamic Web Templates are obviously designed to be used as a page layout tool, sometimes a designer should use an include file. Since the Expression Web Include Page functions like the Dynamic Web Template: at Design Time, a designer can use it regardless of their server environment. By putting advertising code, RSS feeds code, or any other piece of content that the designer wants to be able to include on multiple pages, yet not be locked into having it on all pages as they would with a DWT, the Include Page is a good choice.

In this chapter segment you will use the Include Page feature

Include Page Properties Dialog

Using ASP.NET Master Pages.

Unlike DWT files, which you explored in the previous exercise, the ASP.NET Master Page template system requires a server to combine the content from the content page and the content of the Master Page into one file and pass it off to the browser. You will need ASP.NET running on the server where you intend to host your site(s). The ASP.NET Master Page is an example of a Run Time feature.

In this chapter segment you will create and use an ASP.NET Master Page

ASP.NET Master Page in Expression Web 4

Using ASP.NET User Controls.

At its simplest, you can think of an ASP.NET Web User Control as something analogous to an "include file.” At the higher end of the spectrum, an ASP.NET Web User Control can consist of complex code programmed to perform actions within any Web page that includes it.

In this chapter segment you will create and use an ASP.NET User Control

New ASP.NET Web User Control in Expression Web 4

Using PHP Include Files.

Like the ASP.NET Web User Control, the PHP Include file functionality uses the server to dynamically combine files before they’re served to the browser. By using the PHP Include file you can gain the same advantages over a Design Time Include as you can with an ASP.NET Web User Control.

In this chapter segment you will create and use a PHP Include File.

PHP Include in Expression Web 4

Key Points

  • Because Dynamic Web Templates don’t have any specific server-side requirements, they are a good choice when you don’t know the exact hosting environment for the production Web site.
  • ASP.NET master pages reduce the overall file size of a Web site because their content is combined with their associated content page just before the server passes the file to the browser.
  • You can use ASP.NET Web user controls in many scenarios, from a simple menu to be included into multiple pages, to a complex programmatic collection of code that provides functionality to a Web page.
  • PHP include files are similar to ASP.NET Web user controls. They can be used in a number of scenarios, from including simple HTML code into multiple pages to advanced programmatic work.
  • You can save time and effort by using a well-thought-out strategy, providing better uniformity across all the pages associated with a template or an include file.
  • Run-time features such as master pages, Web user controls, and PHP includes require a server to combine files just before they’re passed to the browser. Design-time features such as DWTs and include pages use Expression Web to combine the files when they’re saved locally.
  • Updating a site that uses run-time features requires publishing only the changed files that are included, but a site that uses design-time features requires that you publish all the pages associated with the DWT or design-time include.




You can easily make this a point to YOUR company OR hide it all together.