Easy Updates with Dreamweaver

SAN FRANCISCO (05/30/2000) - For a Web developer, nothing beats seeing months of hard work pay off with a successful site launch. But once a Web site is up and running, it's often the routine maintenance tasks and site updates that take up most of your time. Such day-to-day work can be short on creativity and long on repetition.

Good Web-editing software can take the drudgery out of maintaining large sites by helping you streamline the process of creating and updating elements that appear on multiple pages. With Macromedia Inc.'s Dreamweaver's templates and libraries, you make changes to just one file and then let Dreamweaver automatically make those changes on multiple pages on your site.

A routine task that might take a half hour if you had to code dozens of pages by hand can take just a few minutes. And unlike a text-based Web editor (such as Bare Bones' BBEdit), which gives you search-and-replace capabilities across multiple files, Dreamweaver's visual interface lets you make complex changes without ever having to touch an HTML tag.

To help you exploit their power, I'll discuss using templates and libraries and how each works. (See "Automating with Templates" and "Automating with Library Items" for step-by-step instructions.)Stepping Up to TemplatesDreamweaver's templates feature can be a tremendous time-saver when you're building and updating frequently used layouts. It lets you create multiple Web pages based on a generic page layout. To modify pages, all you have to do is make changes to a template and have Dreamweaver propagate those changes to every page that's based on the template.

A site can have more than one template. In fact, you can build a different one for each style of page, such as news-story or employee-bio pages.

Let's say, for instance, that you want to add a Jobs button to a navigation menu that's on every page of your company's site. You make your changes to the template and then have Dreamweaver hunt through the entire site, adding the new button to each page that's based on that template.

Studying Libraries

Library items are great time-savers when you have content that appears many times on a site but not in the same place on every page. That's because they work on the element level (rather than the page level). Let's say your site features ad banners from four different advertisers. You can save each banner as a library item and then add it quickly to other pages by inserting it from Dreamweaver's library palette instead of re-creating it every time. If later you need to update the banner graphics-for instance, swap in new graphics or change the hyperlink destinations-you simply change the original library items; Dreamweaver updates the different instances of the banners on your site automatically.

What Doesn't Belong

The efficiency gains that templates and libraries can deliver make them well worth your while, even if you're maintaining a small site. For ideas on expanding the capabilities of templates and libraries, go to "Automating With Templates" and "Automating With Library Items".

MIKE WOOLDRIDGE is a Web designer and the author of Teach Yourself Dreamweaver 3 (IDG Books Worldwide, 2000).

Automating With Templates

Dreamweaver's templates feature lets your computer do the grunt work when it comes to updating elements that appear many times on a Web site. There are only a few basics you need to know to get started. Templates have two types of regions: editable and locked. Locked regions are for the content that doesn't change from page to page, such as navigation buttons and disclaimers. Editable regions are for page-specific elements, such as page titles and body text. By default, all elements of a template start out locked. It's up to you to choose the regions that will be editable on individual pages.

1. Create a template just like you would any other Web page in Dreamweaver. You can build a template from scratch or create it from an already existing Web page. To save your new page as a template, choose Save As Template from the File menu.

To define a region of a template as editable, click and drag to select it, and then choose Modify: Templates: Mark Selection As Editable. Only editable regions (which Dreamweaver highlights in blue) can be changed in Web pages that are based on a template.

2. To create a Web page based on a template, choose File: New From Template.

Then make the changes you want (such as adding a graphic or text) to the editable regions. It's easy to see which regions you can edit, since Dreamweaver highlights the ones you cannot-the locked regions-in yellow. On this employee page, only the personal details and image are editable.

3. If you want to change locked regions in a Web page, you must open the original template file (located in the site's Templates folder) and make the changes. Here, I added a line for e-mail addresses, revised the company slogan, and jazzed up the background.

4. Finally, save the edited template. When you do, Dreamweaver will prompt you with an alert box asking if you want to update pages based on the template.

Click on Yes, and you're done. The window shown here displays the results of my update. Dreamweaver updated ten of the site's files; I updated only one-the template.

Automating With Library Items

Dreamweaver lets you use a library to store page elements, such as tables, that you'll use over and over again.

Instances of a library item you've added to a page cannot be edited on a page-by-page basis. Instead, you must open the original library item from the site's Library palette if you want to edit it. When you tell Dreamweaver to apply the changes sitewide, it updates every page that contains an instance of that library item.

Sometimes you'll want the convenience of storing a Web-page element as a library item, but you'll also need the flexibility of customizing the item individually after you insert it into a page. Here's how to do both. I'll use the example of creating a generic, two-celled table that's designed to hold an image and a caption.

1. First, create a two-celled table in the Document window. To save it in your site's library, select it, then choose Modify: Library: Add Object To Library.

You can use this library item each time you add an image and caption to your site.

2. The Library palette displays all the library items available for a site (A).

To add this library item to a page, select it in the Library palette (B) and click on Insert (C). The table is inserted into your document (D). At this point, you can have Dreamweaver change the table in your document by changing the item in the library.

3. When you initially add the two-celled table to a page from the library, you can't customize it because instances of library items are locked. To edit it, you must dissociate it from the library by clicking on the Detach From Original button in Dreamweaver's Property Inspector. (If the Property Inspector is closed, open it by selecting Properties from the Windows menu.)4. Once you detach the table from the library, you can customize the table with an image and caption. However, you can no longer change that instance of the table by changing the original library item.

Join the newsletter!

Error: Please check your email address.

More about Macromedia

Show Comments

Market Place