How to use templates in Dreamweaver

Source: Internet
Author: User
Tags add modify version window blank page dreamweaver
dreamweaver| template in the Web Design Tool Dreamweaver (hereinafter referred to as DW, currently the highest version of 4.02, this example in the case of the 4.0 version) there is a very powerful function, is the template!

What's the charm of that template? What kind of characteristics does it have?

Using templates, we can solidify the elements that appear on every page of the site.

Creating a Web page by using a template makes the entire site a unified style.

As long as you modify the template, you can modify all Web pages that have the template applied, without having to manually modify each page. For example, when you need to change your copyright, do you want to make a copy of the copyright changes on one page? What if there are thousands of pages? I believe you will be a head two or three big. But if you use a template, none of this is a problem.

Here is a more comprehensive example that allows you to quickly master the use of templates.

1. Edit Page

Open DW, create a new site, we will be named "Spider web."

Create a new blank page as the inner page (usually a website has only one homepage, so we can not make a template on the homepage), named Body.htm.

Edit this page, complete as shown in Figure 1.



Figure 1, after editing the completed Body.htm page, note that A is here as an editable region, as described below.
2. Generate templates

When the edit is complete, we save the page as a template (note that it is not saved as a normal HTM page). You can save as a template through the Fileàsave as template in the DW, and the Save As Template window pops up when you execute this command, as shown in Figure 2.



Figure 2,save as Template window.

The B in Figure 2 is the choice of site, we choose "Spider Web", C for us to save as the template file name, we fill in the body. Save by pressing save in the upper-right corner.

At this time we press F8 pull up site (site manager), in the Templates folder can see BODY.DWT (when there are template files, DW will automatically generate Templates folder, DWT for template type files)

3. Edit Template

Open the BODY.DWT template file in the site, you will find that the body.htm page seems to be no different, but in fact, is not the same, in the body.htm can not add editable regions. Editable regions can only be added to the template file.

In order to better understand the "editable region", we first use this template to generate an HTM file: Point fileànew from Template, pop-up Select Template window, select the body in the emplates, Then click Select in the upper right corner to generate a new HTM file. We will rename this new page to body2.htm. Now we're going to use DW to open body.htm and body2.htm two files and compare what's different. You will find the word "Template:body" written in the upper-right corner of the body2.htm page. (Note that this page is generated by the BODY.DWT template file) and you will be surprised to find that body2.htm files are not editable (body.htm can be edited). By the way, this is because the body.dwt template file does not have the result of defining an editable region, so that the resulting page is not editable. So we have to add editable regions to the template file. Here are the steps to add an editable region:

1 Open the BODY.DWT template file, we hope that the middle table can be edited (that is, in Figure 1, section A). But to be in the body.dwt file, not the body.htm, you add an editable region here.

2 the mouse cursor into a table, click the right mouse button, select New Editable Region ..., pop-up new Editable Region window, require the name of this editable region (we are often called editable region tag). We fill in the Region01 and click OK to close this window to finish editing the current editable region tag. You can see this in the table as shown in Figure 3.



Figure 3,new Editable Region window.

Explains that there is an editable region labeled Region01.

So far we've defined an editable region, and if you have more than one editing area, you can do the same.

※ can also pass modifyàtemplatesànew Editable Region ... To create a new editable region, if you want to delete the editable region, you can use Modifyàtemplatesàremove Editable Region ... and then follow the prompts.
4. Create a page with a template

In fact, we mentioned earlier that the process of using templates to generate pages is through the fileànew from Template. Please refer to the steps in step three. Now we use the template to generate a page called body3.htm. At this point, you will find that in the Body3.htm page, in addition to the editable region Region01 can be edited, other places the mouse has become a restricted state. We add what we need in this editable region, such as we write a random article. This allows the template to be used to generate pages based on our needs.

5. Modify template content and update site files

Open the BODY.DWT template file, change the place we need to modify, such as we change the logo image or modify any non-editable region, or even add or delete editable regions.

The following is used to change the logo to explain how the template is updated files.

We change the logo image to another we like the picture, the completion of the save BODY.DWT file, then DW will pop up the window to ask if you need to update the file, select UPDATE,DW will automatically all use this template generated pages are updated, update DW will pop up update pages window , and the update log is given in the Update Pages window when finished.

※ If you choose don ' t update,dw directly to keep the template file, temporarily do not update the page, but we can manually update the page, just select Modifyàtemplatesàupdate pages ... Can.

At this point we open any page generated with BODY.DWT, such as body3.htm. Will find that the logo image has changed.

It is not difficult to find, the use of this function, we can easily solve the problem of site updates, template function is very strong, this article only played a role, many features due to the length of the problem could not be mentioned, they have to try more, so as to fully appreciate the template style of DW.

In the DW, there is also a function called library, with the template can be an organic match, this will make the template more powerful, if the reader is interested in the response, I would like to present this gift.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.