How to Create and Manage Multiple Pages on Your Website with Expression Web

Chapter 7: How to Use Dynamic Web Templates (DWT) for a Multi-Page Site


How to Create and Manage Multiple Pages on Your Website with Expression Web

by Christopher Heng, thesitewizard.com

Now that you have completed your home page, it's time to create the rest of your site. To do this, we will take advantage of the facilities provided by Expression Web to simplify the creation and maintenance of multiple pages.

As implied by the previous paragraph, this article assumes that you have done the earlier chapters of the Expression Web tutorial. Complete newcomers to web design should probably start at the beginning, with How to Create Your Own Website.

Goal of This Chapter

By the end of this chapter, you will have created most of the pages of your site. You will also have learnt ("learned" in US English) how to use Expression Web's Dynamic Web Templates to efficiently create and update those pages.

Introduction to Expression Web's Dynamic Web Templates

Up until now, your website has only one page. As such, any time you wanted to change its design, you only had to make it in one file. Things are not so simple when your site grows beyond that single page: for example, what happens if you want the navigation menu to have an additional button? Does it mean that you have to go through every single page to add that button?

This is where Expression Web's Dynamic Web Template (or "DWT" for short) comes in. It is a "template" in the normal English meaning of the word, with some additional features. When you create a new page based on that template, it will take on the appearance of the latter, so that all you need to do is to add the content that is specific to that page. Even better, when you have a change of heart, and want to modify the design, all you need to do is to modify the template. Expression Web will automatically notice that your site's design has changed, and update all the relevant pages with that new design.

How to Create a Dynamic Web Template (DWT)

  1. Open your home page in Expression Web, if it is not already open.

  2. Click "File | Save As..." from the menu.

  3. In the familiar "Save As" dialog box, click the drop-down box for the "Save as type" field and select "Dynamic Web Template (*.dwt)" from the list offered.

  4. The "File name" field will now read "index.dwt". This DWT file will be the template for your entire site. You can either leave its name to "index.dwt" or change it to some other name, but with a ".dwt" extension. For example, if you want to change it to "mydesign", type "mydesign.dwt", without the quotation marks. The name doesn't really matter though, since you are not going to put this file onto your website. It's just an internal file used by Expression Web.

    For the purpose of this tutorial, so that I can concisely refer to the file, I will assume that you left the name at "index.dwt".

  5. Click the "Save" button.

  6. Look at the tabs just above your page. Instead of the usual "Site View" and "index.html" tabs, you should now see "Site View" and "index.dwt", with the latter being the current tab (see picture below). Your "index.html" is not gone; it's still on the hard disk, but you are now working on your template file.

    The Site View and index.dwt tabs

    Bear this in mind as you work from now on. That is, be conscious of which file you are actually working on. When you want to change the design of your entire site, you need to modify the DWT file. When you want to add content to an individual page, it needs to be done on the HTML page itself.

  7. By default, Expression Web assumes that every part of the page in a template is part of the design. This is of course not correct. You only want the basic two column layout, the navigation menu and the top horizontal strip containing your logo to be standard across all your pages. The bulk of the right column (where your content lives) will probably vary from page to page (unless you really want every page to be an identical copy of your home page).

    In order for Expression Web to know which region of your page is part of the site's design, and which portion contains unique content, you need to specifically indicate it in your template. Otherwise, the editor, being unable to read your mind, will default to treating everything as the invariant part of the design.

    Essentially, what you will be doing now is setting up what Expression Web calls "editable regions". These are the sections of your page that will have different content on different pages of your site. You can have multiple editable regions on each page, and they can be separated by portions that is part of the fixed design, or they can be contiguous with other editable regions.

  8. To mark a region of your web page as editable, first drag your mouse over that section to select it.

    Note that if you want the entire content column to be editable, that is, if it is to be completely different on every page (as is quite likely), it may be simpler to select the entire column instead of individually highlighting each paragraph, one at a time. To do this, click to put your text cursor somewhere in the right column. Then look at the series of tabs just underneath the "Site View" and "index.dwt" tabs. Click the "div#tswcontproper" tab (see picture below). The entire right column should now be selected.

    The div#tswcontproper tab

    Some of you may be wondering what the difference between div#tswcontproper (used above) and div#tswcontent (used in chapter 3 to change the background colour) is. Although both refer to the right column, div#tswcontproper only holds the content in the right column, while div#tswcontent holds both div#tswcontproper and a narrow border around the latter. It provides a sort of margin, an area of blank space, so that your words don't go right up to the edge of the screen, making things difficult to read.

  9. Click "Format | Dynamic Web Templates | Manage Editable Regions..." from the menu.

  10. A dialog box with the title "Editable Regions" will appear. You will be required to give this region a name. Presumably, this name is meant to jog your memory in the future so that you know what the region is supposed to contain. The name can be anything you like. For example, if you have selected the entire right column, type into the "Region name" field the words "Page content" or "Content" or "Page-specific stuff" or whatever you want. (Yes, you can use spaces in the name.) This name will be displayed when you edit the page, but will not be shown to a visitor when he/she sees your site in a browser.

    Having said that, the names of your template file (ie, "index.dwt") and all editable regions will also be embedded into your web page. It will just be invisible to your visitors when browsing your site normally. However, if they take the trouble to use their browser's "View Source" facility, they can see the names you have chosen. In other words, don't put secret things (like your bank password) as the names of your editable regions. Things like "Content", "Product Description" or "Price" are fine. It should be obvious from your page that it's the "content", "product description" or "price" that they're reading anyway, otherwise you have bigger problems than dreaming up these names.

    To summarize, type in some word or words into that field that describe the section. Or, if naming things gives you a massive headache, just type in "region 1", "region 2", "region 3", etc.

  11. After you type in the name, the "Add" button will be enabled. Click it. The name will be added to the list of names in the box below. If this is the first time you're adding a name, this will result in two names being in the list: the one you just added and "doctitle".

  12. Click the "Close" button to dismiss the dialog box.

  13. Notice that the section that you previously selected will now be marked with the name you entered.

  14. Repeat the process for the other parts of the page that should be changeable. For example, if you have placed a copyright notice in the footer, you may want to make the year portion an editable region, since it's possible that you will create new pages in future years too. Yes, you can select a single word and add it as an editable region if you like.

  15. You don't need to make your logo (in the masthead) and the navigation menu (in the left column) editable regions. These are after all supposed to be part of the design that is the same across your site. Not making a part of the page an editable region has the following effect:

    1. That portion of the page cannot be changed on the individual pages derived from this template. It will be the same on every page. That's what you want, since it is supposed to be part of the design.

    2. If you want to change those sections, you will need to change it in the DWT file itself.

    3. Whenever you change these non-editable regions in your template, Expression Web will automatically update all the pages derived from it with the new design.

  16. When you have finished adding editable regions to your page, click "File | Save".

How to Associate Your Home Page with the Template

You now have a template from which you can derive new pages. However, before we do this, we have to deal with your home page. Remember that the latter was manually created by you, independent of any template. As such, Expression Web does not view that page as having been derived from your new DWT file. If we don't do something about this, in the future, when you change your site's design, the editor will not automatically update the home page, since as far as it is concerned, it is not connected with the template at all.

The simplest way to associate the home page with the template, is to replace your old "index.html" file with a new one that is made from the template. This doesn't require much work, since the template is based on your home page, and when you created it, you didn't make any change to its appearance or content. All you did was to mark certain sections as editable regions. Any page made from it will therefore look exactly like your home page by default. This similarity, however, is only skin deep. Under the hood, it has invisible markers that tell Expression Web that it was made from your template, which is what we want.

  1. Close the template with "File | Close". This avoids confusion later where you might accidentally end up changing the wrong file, since both your template and home page look identical.

  2. Click "File | New | Create from Dynamic Web Template...".

  3. Click your template file (eg, "index.dwt") in the "Attach Dynamic Web Template" dialog box that appears.

  4. Click the "Open" button to accept your choice.

  5. A new page that looks exactly like your template and old home page will appear, along with a dialog box that says "(1 of 1) files updated." Click the "Close" button in that dialog box.

  6. Without making any changes to the page, immediately click "File | Save As..." from the menu.

  7. In the "Save As" dialog box that appears, click your home page (ie, "index.html") to select it. Yes, as mentioned above, you are overwriting your existing home page.

  8. Click the "Save" button.

  9. Click "Yes" in the "Confirm Save As" dialog box to allow Expression Web to replace your old index.html with the new one.

  10. Since this is the same page that you have already completed in chapter 6, there is nothing more to do here. Just click "File | Close".

That's it. As of now, whenever you change the non-editable sections of your template file, Expression Web will automatically update your home page as well.

How to Create Additional Web Pages from the Template

The process of creating the other pages of your website is similar to that of recreating your home page, except that there are a few extra steps to take.

We will start with the site map.

How to Create a Site Map

A site map is essentially a comprehensive index of all the pages on your website. You can see an example of it by looking at thesitewizard.com's Site Map. As you can see, the entire page consists of links pointing to all the articles on my site. It is the web equivalent of an exhaustive table of contents that you find in a physical book. Visitors looking for something, but don't know how to get to it, can consult this map. In other words, it serves to improve your your website's usability. Another benefit is that it helps search engines discover all the pages on your site.

Incidentally, don't be distracted by the 3 columns that I used in my site map. Since I had hundreds of pages to list, I put it into multiple columns to make the page appear shorter. (It seemed a good idea at the time.)

I realise that you don't have many pages at this point to list. However, you should still create this, since you will eventually have more. If you don't do it now, when the job is easy, and put it off till you have hundreds of pages, you'll decide at that time that it's too hard to do. If you create the map at the very beginning, you can simply add a new link to it every time you add a page, making it a trivial and doable task.

  1. Click "File | New | Create from Dynamic Web Template...".

  2. Select your template file and click "Open".

  3. Click the "Close" button to get rid of the pointless dialog box telling you "(1 of 1) files updated".

  4. Click "File | Properties" from the menu. The "Page Properties" dialog box that you first met in chapter 1 will appear.

  5. Change the "Title" field to say either "Site Map", "Site Map (Example Co)" or "Example Co's Site Map" (of course replacing "Example Co" with the name of your site). Although no one will stop you from saying whatever you want, it's best to have the words "Site Map" somewhere in the title field here, since, by convention, that is the term used for the kind of page you are about to design.

  6. Click the "OK" button.

  7. Now replace the content of the page. Since you made the content into an editable region, Expression Web will let you modify it without issue.

    Start by putting a heading of "Site Map" somewhere at the top of the page, replacing whatever heading you had previously.

    Then create a link to each page of your site on a separate line. Since you don't have many pages at this time, just create 2 or 3 links. Start by putting a link to the Home page on one line. Then put one to the Contact (or Support or Feedback) Form on another. The link to the Contact form should point to either "feedback.html" (if you are using relative URLs) or "http://www.example.com/feedback.html" (if you are using absolute URLs; remember to replace "example.com" with your own domain), otherwise when you actually create your feedback form in the last chapter, your site map will not link to it correctly. If you want an About Us page, create a link for that too (eg, with "about.html" for the filename portion).

    Note that unlike your navigation menu, the link to the home page does not have to be at the top. In fact, you can arrange your links in any order you want, eg, alphabetically or grouped by topics or whatever.

    Since hitting the ENTER key after each line creates a new paragraph, leaving far too much space between each link, you will want to use a different method for moving each link to a new line. One way is to use Shift+ENTER on the keyboard after each line, that is, hold down the Shift key while hitting ENTER. Whatever you type next will go onto a new line in the same paragraph.

  8. When you have finished populating the page with links, click "File | Save As..." and type "sitemap.html" into the "File name" field. Remember that this is the name you used in your navigation menu (see chapter 6), so if you enter something different here, your navigation menu button will lead nowhere.

  9. Click the "Save" button.

You should return here to add a new link each time you create another page. You will probably not appreciate the site map very much since, as the webmaster, you are already intimately familiar with your website. But your visitors will find it helpful, especially when your site grows to have many pages.

Creating the About Us Page

The "About Us" page is used by webmasters to tell their visitors a bit about the company or people behind the site. If you are running a business, selling either products or services, you probably should create one. The page is optional for people running personal or hobby websites. Whatever your situation may be, remember that the things you write here can be read by anyone, from lunatics and criminals living in your neighbourhood to your future employers, so be circumspect as to what you reveal.

If you don't want to have an "About Us" page, just skip to the next section.

  1. Click "File | New | Create from Dynamic Web Template...".

  2. Select your template file and click "Open".

  3. Click the "Close" button to dismiss the message telling you "(1 of 1) files updated".

  4. Click "File | Properties" to get the "Page Properties" dialog box and change the "Title" field to "About Us (Example Co)", "About Example Co", "About Us", "About Me" or words to that effect.

  5. Modify the content in the editable regions to say the things you want to say. If you are adding photos to this page, remember that you have to copy them into the images folder as you did in chapter 2.

  6. Save the file as "about.html" or whatever name you used earlier in your Site Map and navigation menu.

Create the Other Pages of the Site

Now that you're familiar with creating new pages from the template, having already done it 2 or 3 times, you should proceed to create the rest of your site. Remember to set the title field of each page you create. In addition, you may also want to read my article on how to create good filenames for your web pages to avoid long term problems.

Note: do not create the contact form yourself. I will deal with that at length in chapter 9. Forms are a bit more complicated than the usual web page.

If the page you are creating is an important one, consider putting a button in your navigation menu pointing to it. As mentioned before, whether a page is important or not depends on the purpose of your site. However, since you probably didn't put the navigation menu in an editable region of your web page (for good reason), you will need to modify the template itself to insert the button. This is the subject of the next section.

How to Modify the Template

If you are changing your website's design in some way, whether to accommodate a new button on the navigation menu or to alter its colour scheme or some other thing, you will need to make your changes in the template itself.

  1. Save and close all open files in Expression Web.

  2. Open your template file by doubleclicking the "index.dwt" line in Expression Web's Site View pane.

  3. Make your changes to the non-editable regions.

  4. Click "File | Save" from the menu.

  5. You will get a dialog box saying "There are [number] files attached to index.dwt. Would you like to update them now?", where [number] is some numeral depending on how many files you have created based on the template.

    Click "Yes".

  6. Expression Web will then proceed to change all the files derived from the template. When it is done, it will report on the number of files that it has modified. If you like, you can click the "Show Log" checkbox to see the list of files affected.

    Click the "Close" button when you are done with the report.

  7. Click "File | Close" to close the template.

  8. If you open one or more of your other pages, you will see that the changes you made to the template have indeed percolated to all the dependant files.

Next Chapter

In the next chapter, you will transfer your website onto the Internet. (Don't worry. I know that you still haven't created your contact form. The reason for doing things in this order will be explained in the next chapter.)

Copyright © 2016 Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from https://www.thesitewizard.com/.

You are here:

Top » Getting Started with Your Website »

How to Create / Make Your Own Website: The Beginner's A-Z Guide » List of All Expression Web Tutorials »

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to thesitewizard.com newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at https://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.

Related Articles

New Articles

Popular Articles

How to Link to This Page

It will appear on your page as:

How to Create and Manage Multiple Pages on Your Website with Expression Web





Home
Donate
Contact
Link to Us
Topics
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Domains
Web Hosting
Blogging
JavaScripts
PHP
Perl / CGI
HTML
CSS
.htaccess / Apache
Newsletters
General
Seasonal
Reviews
FAQs
Wizards

 

 
Free webmasters and programmers resources, scripts and tutorials
 
HowtoHaven.com: Free How-To Guides
 
Site Design Tips at thesitewizard.com
Find this site useful?
Please link to us.