Creating a Template

You can begin the process of creating a Dreamweaver MX template in three ways:

  • Create it from scratch by choosing File ® New. This way, you begin with a new, blank page. You then lay out the elements of the site design you've planned and save the page as a template.

  • You can also base a template on an existing document. This way, all the elements of your design are in place (if you've planned the master document carefully), and you just need to designate which elements are repeating, which are editable, and so on.

  • For many sites you will begin without a template. In this case you are often forced to apply new templates to existing content. In general, you create a new template and then base documents on the new template.

With any of these methods, Dreamweaver MX saves the template file with the .dwt extension in a special Templates folder in the active site's local root folder. This folder probably won't exist the first time you add a template to your site, but don't worry-Dreamweaver MX will create the folder for you.

Warning 

Dreamweaver MX documentation warns you not to remove templates from the Templates folder or store nontemplate files in this reserved folder because either action will result in errors. The truth is, as long as your templates are properly linked, it doesn't really matter where you store them. And there's nothing special about other formats that will cause your application to suddenly crash if a nontemplate file is encountered in your Templates folder. It's simply a warning to keep you from unintentionally breaking links or creating links to the wrong type of file.

Creating a Template from a New Page

To create a template from a new blank page, follow these steps:

  1. Choose File ® New to open the New Document dialog box, as shown in Figure 23.1.

    click to expand
    Figure 23.1: Choose a page category and type.

  2. Make sure the General tab is selected, and then select Basic Page, Dynamic Page, or Template Page from the Category list. The list to the right updates accordingly to display basic or dynamic page types. Clicking the Templates tab will give you access to any templates stored in a Dreamweaver site. In this case, we've chosen Dynamic Page, because the template we will build later in the chapter will be based on an ASP (Active Server Pages) page.

  3. Choose the appropriate page type from the Dynamic Page list, and then click Create. Don't select Template Page at this point-we're using templates to lay out the design and structure of the page.

    At this point, your work has just begun. Now you need to build the template, adding the elements of the site design you've planned. You'll work through a complete example of that process in the upcoming section, "Building a Template."

  4. Once the elements are in place, Select File â Save As Template and give your template a name.

Creating a Template from an Existing Page

To create a template from an existing page, follow these steps:

  1. Choose File ® Open to open the Open dialog box, and select the document.

  2. You can double-click a document to open it, or select it and click Open. After opening the document, choose File ® Save As Template to open the Save As Template dialog box, which is shown in Figure 23.2.

    click to expand
    Figure 23.2: Identify the site to which you're adding the template.

  3. Identify the site to which you want to add the template, and name the template. In our example, we've chosen the MasteringDreamweaver site and named the template MDW1.Also notice that currently, we have no other templates.

  4. Click Save.

    Note 

    When you save the template at this point, Dreamweaver MX might display a warning that the template doesn't contain any editable regions. That's because you haven't designated any yet. Click OK to continue or click Cancel to abandon the current save task. If you choose Cancel, Dreamweaver MX won't create a template from the current document. You can disable this warning by clicking the Don't Warn Me Again option, but you probably shouldn't.

  5. Click F11 to display the Assets window, shown in Figure 23.3.As you can see, Dreamweaver MX added the new template to this window. Simply double-click a template item in the list to open that template's document.


    Figure 23.3: You can access a template in the Assets window.

Creating a Template from the Assets Window

You can also create a template from the Assets window. To do so, follow these steps:

  1. In the Assets window, click the Templates button to select the Templates category.

  2. Click the New Template button, or right-click the list area and choose New Template from the shortcut menu. Figure 23.4 shows the results. Dreamweaver MX adds a new, as yet unnamed template to the list.


    Figure 23.4: Dreamweaver MX lists templates in the Assets window.

  3. While the name is highlighted, type a name for the document.

  4. To open the new template in the Document window, double-click it in the Assets list or click the Edit button.

Now you can add the elements of your site design to the template, as you'll do in the "Building a Template" section.

Tip 

To open the Assets window, choose Window ® Assets or press F11.



Mastering Dreamweaver MX Databases
Mastering Dreamweaver MX Databases
ISBN: 078214148X
EAN: 2147483647
Year: 2002
Pages: 214

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net