|< Day Day Up >|
18.2 Create a Template
The first step in creating a template requires building a basic Web page and telling Dreamweaver you'd like to use it as a Template. You can go about this in two ways: build a Web page and turn it into a template, or create a blank empty Template file and add text, graphics, tables, and other content to it.
18.2.1 Turning a Web Page into a Template
The easiest way to create a template is simply to base it on a Web page in your current site folder. Although you can create templates based on Web pages that aren't part of the current local site, you may run into problems with links and paths to images, as described in a moment.
Once you've opened the Web page, just choose FileSave As Template or, on the Common tab of the Insert bar (see Figure 18-2), click the Templates button and select Make Template from the menu. In the Save As Template window (Figure 18-3), the name of the current local site appears in the Site pop-up menu; meanwhile, all templates for that site show up in the Existing Templates field.
At this point, you could theoretically use the Site menu to save a template into any local site folder you've defined (see Chapter 14 for a discussion of local sites), but be careful with this option. If your page contains images and links and you save it as a template for another local site, Dreamweaver won't copy the images from the first site folder into the other one. As a result, the paths to the image files and links won't work correctly.
If you must use a page from one site as a template for another, copy the Web page and graphics into the new site's root folder, open the page from there, and then create a template as described here.
Finally, type a name for the new template, and then click Save. Choose Yes when Dreamweaver asks if you want to Update Links for the page. If you choose No, all page-relative links will break, and all the images on the page will appear as broken image icons.
Dreamweaver saves the page in the Templates folder of your local site root folder. It adds the extension .dwt to the file to indicate that it's a Dreamweaver template. (For dynamic Web pages, Dreamweaver adds the .dwt before the file's extension. For example, an Active Server Page template might have a name like maintemplate.dwt.asp.)
18.2.2 Building a Template from Scratch
It's easiest to create a Web page first and then save it as a template, but you can also build one from scratch. Open the Asset panel's Templates category by choosing Window Assets and clicking the Template icon (see Figure 18-4). Then click the New Template button at the bottom of the Assets panel. Once Dreamweaver adds a new, untitled template to the list, type a new name for it. Something descriptive like "press release" or "employee page" will help you keep track of your templates.
After you've created a blank template for the site, you can open it by double-clicking its name in the Assets panel (or selecting its name and then clicking the Edit button at the bottom of the Assets panel). It opens just like any Web page, so that you can get busy designing it.
|< Day Day Up >|