Dreamweaver:
Creating Rollovers, a Library Item and a Template

The following written instructions are for Dreamweaver version CS4 and will also work with CS5. The interface illustrations are of CS4 and older versions in which case they will be very similar to CS4 and CS5. Windows instructions are written based on Windows XP.


Dreamweaver is one of the premiere html editing programs available today. In addition to generating html, it also creates CSS (cascading style sheets) and some JavaScript and AJAX. Dreamweaver also has an exceptional file management system and an ftp utility to manage both your local and remote web sites.

In this exercise we will explore the use of Dreamweaver's Template and Library capabilities. These are used to expedite the creation of Web pages and also for updating those pages more easily whenever changes are needed in the future.

In the process of learning about templates and library items we will also be creating a set of rollover buttons. Rollover buttons change when you roll your mouse pointer over them. Dreamweaver generates both html and JavaScript to accomplish them. A set of buttons used for getting around a web site is usually called a navigation bar.


stamp and stamp padDreamweaver Templates

Dreamweaver template files are used to generate new files that look like the template. The files that are created can be modified to the extent permitted by settings specified within the template file. Dreamweaver templates are a lot like the templates you may have already used in programs such as Microsoft Word or Excel and the procedure for creating them is about the same with this exception: areas need to be designated in the template to allow those areas to be edited in the pages derived from the template. Areas not designated to be editable cannot be changed in the files derived from the template.

Typical uses of templates in Word are letterheads and envelopes. In Dreamweaver, templates are used to rapidly turn out pages that are identical in most ways, but have differences in one or more specific areas. This can include pages used to display information such as individual items for sale or the biographies of each member of a company's management team. These types of pages would probably be expected to look almost the same except for a photo of the item for sale (or of the manager in the case of the latter) and the text related to it.

Top

Note: The following section ("The General Procedure") describes in a general way how a procedure is accomplished. It is not intended to be step by step instructions. The steps for you to follow to complete this exercise will begin in the section: Get Dreamweaver, Set Your Resolution, Get the Files and Folders. It ought to be obvious when you get there what steps to take.

The General Procedure

The process for creating a template is straightforward. First, you create a file with the objects, formatting, and layout that you want to use as the basis for future files. Then, you select from the File menu: Save as Template...

As mentioned above, an important difference between Dreamweaver and Word templates is that with Dreamweaver you need to designate certain areas as being changeable (editable) and others as not editable (which is the default).

This prevents you from inadvertently modifying those parts of a file derived from a template that you may not want changed, such as navigation buttons, background color, logo, a company email link, etc. It is an important concept to grasp because, unless you designate otherwise, no part of a file made from a Dreamweaver template can be changed.

After creating the template, whenever you want to create a new file that uses the template file as its starting point, begin by using File -> New -> and then in the New Document dialog box that opens, select Page from Template from the left column and then select the template you want to base your new page on from the list that appears.

Then a new file will open that will be identical to the template, however you would not be able to modify anything but those sections previously designated as editable regions. As one might expect, changes made to the derivative file would not affect the original template file. To modify the template itself it is necessary to modify the original template file.

We will be making a template as a part of this exercise.


Library Items

We will also save as a library item a group of four rollover buttons (a navigation bar) that we will create using images that I will provide. Library items in Dreamweaver are parts of a page that you save as a separate special file. You can then use the library item on many different pages.

The difference between a library item and a template is that a template provides a complete html file and a library item is a part of an html file. Library items can be things such as buttons, tables, banners, or a group of text links such as the ones you often find at the bottom of a web page.

Dreamweaver saves templates as .dwt files and library items as .lbi files. As soon as you create one or the other, a folder is automatically created by Dreamweaver to contain it named (not too surprisingly) Templates and Library respectively. You will find these folders in what Dreamweaver asks you to define as your site's local root folder, which we will discuss in a minute.

Templates and library items are similar in that when you change the original template or library item file, every instance (each use) that has been derived from it can be updated simultaneously, with your approval. This simplifies making global modifications of your site's files. For example, if you change the address of a link in a navigation bar in your library, then all pages using that same library item will be updated automatically as well.

Note that in the case of many if not most scenarios, any files that have been affected will be changed only on your computer (in your "local site") and not on the server, which is where copies of the files that you work on are usually made available for the world to access. The files derived from the template or library item that has been changed will need to be re uploaded. Dreamweaver provides various tools for doing this. However, for this exercise we will not be uploading any files to the web.

Top


Get Dreamweaver, Set Your Resolution, Get the Files and Folders

First of all, if you haven't downloaded the latest version of Dreamweaver, please do so. Please do not download other Adobe programs or a "suite", just download Dreamweaver. I recommend that you use "Option 1":
Adobe Dreamweaver 30 day trial download

If you have an earlier version of Dreamweaver, use one of these:

Monitor Resolution

Make note that Dreamweaver recommends that you set your monitor resolution to be at least 1024 x 768. Otherwise, you may not be able to see all of the parts of the interface. Those of you with 17 inch monitors may have your monitor set to 800 x 600. To check or change your resolution, using Windows XP:

  1. Start button -> Control Panel -> double click on Display
  2. This opens the Display Properties dialog box.
  3. Setting tab -> Screen Resolution
  4. Move the slider until it says 1024 by 768 pixels
  5. Click on OK
  6. It might take a few moments for the setting to be completed during which time your screen might go black.

Get the Files You Need:

Download this file and extract its contents:

rooftop.zip

In case you need them, here are detailed instructions for saving the files from the link:

Windows XP users:

  1. Right-click on the link: rooftop.zip
  2. Select Save Target As, (or Save As, or similar) and save the zip file somewhere you can find it.
  3. Go to the zip file's location using My Computer or Windows Explorer.
  4. Double click or Right-click on the file and select Extract All.
  5. You should now have a folder named rooftop which contains the folders and files you will be using.

Mac users:

  1. Control-click on the following link (or right-click if you have a 2 or 3 button mouse): rooftop.zip
  2. Select Download Link to Disk (or a similar command) and save the zip file somewhere you can find it.
  3. Find the file in Finder.
  4. Double-click on the file. The contents should self-extract.
  5. You should now have a folder named rooftop which contains the folders and files you will be using.

Check the files and folders:

  1. In the rooftop folder you will see two folders: html and images.
  2. The file basic.html will be in the folder named: html.
  3. The following will be in the folder: images:

If you get "Permission" Problems:

Note that when you first try to open the basic.html file in Dreamweaver, you may get a message that asks you if you want to "Make Writ able" the file. If that were to happen, agree to it. In other cases, if you do have any problems when you try to save that file, it may be due to permissions. To alleviate this problem if it occurs:

Windows XP users:

  1. Find the file (basic.html) in My Computer or using Windows Explorer..
  2. Right click on the file's icon.
  3. Select Properties from the bottom of the menu.
  4. In the dialog box that opens, in the General tab section, uncheck the Read Only check box.
  5. Click Apply then OK.

Mac Users:

  1. Find the file in Finder.
  2. Select it.
  3. Press the Command-i keys on your keyboard (this provides "Information")
  4. At the bottom of the Info box that appears, set the Ownership & Permissions so that you can Read & Write

Navigator Wheel Icon

  1. You may see a little square with a ship's steering wheel pop up after you have hovered over an area for two seconds. This can be annoying and it is not needed for this exercise. It allows easy access to css and other code that are not part of this assignment.
  2. Click on it when it appears and disable it.
  3. If you want to re enable it later:

Top


Local Root Folder and the Cache

We will be defining a local root folder in a moment. First, an explanation about this. One of the most important things to do when using Dreamweaver is to create a folder on your computer and then designate that folder as the local site.

A local site is nothing more than a folder that you create on your computer that will be used to contain all of the files associated with one web site. This includes a local (that is, on your computer) group of files that get put on a remote computer (a web server) for the world to see. You can keep any files at all in it, such as related MS Word documents, not just HTML, GIF and JPEG files. For example, you can store original image files, text files from your clients, production checklists, etc., in it.

Creating a local site allows Dreamweaver to keep track of where files are and any movement of them. It can then automatically update any affected links in the code resulting from moving folders and files or changing a link on any page in your site. Otherwise you would need to manually go to each file and change the links in it, which can be a huge undertaking fraught with the risk of forgetting to change some affected code and making mistakes in the code.

In order to accomplish this, Dreamweaver generates a cache of information about the files and folders in the site and the relationships between them (links, paths, etc.).

Top


Define the Local Site

Launch Dreamweaver.

For versions CS5 and later follow these instructions:

  1. Select Design from the View menu in order to see a preview of the page and not the code.
  2. Next, you will define the site...
  3. Using Dreamweaver's main menu bar go to:
    Site -> New Site
  4. The dialog box: Site Setup for Unnamed Site 1 will open.
  5. Enter these items:
    1. Site Name: Rooftop Restaurant
      • If you have created a site with the same name for a different exercise of mine, please use this name instead: ROL Exercise - Rooftop
    2. Local Site Folder:
      1. Click on the little folder icon to the right of the Local Site Folder selection window.
        • Note: the name of the dialog box now changes to Site Definition for Rooftop Restaurant)
      2. This dialog box should open: Choose Root Folder
      3. Navigate to the folder you unzipped named rooftop
      4. Double click on it to select it.
  6. Click Save to close the Site Setup dialog box.
  7. A message might pop up regarding cache. Agree to cache – this will enable Dreamweaver to control file management.

For versions CS4 and earlier follow these instructions:

  1. Select Design from the View menu in order to see a preview of the page and not the code.
  2. Next, you will define the site...
  3. Using Dreamweaver's main menu bar go to:
    Site -> New Site
  4. The dialog box: Site Definition for Unnamed Site 1 will open.
  5. At the top of the dialog box, click on the Advanced button.
  6. On the left side, select Category: Local Info
  7. Enter these items:
    1. Site Name: Rooftop Restaurant (note: the name of the dialog box now changes to Site Definition for Rooftop Restaurant)
      1. If you have created a site with the same name for a different exercise, please use the name: ROL Exercise - Rooftop
    2. Local root folder:
      1. Click on the little folder icon to the right of the Local root folder selection window.
      2. This dialog box should open: Choose local root folder for site Rooftop Restaurant
      3. Navigate to the folder you unzipped named rooftop
      4. Double click on it to select it:
        • The selection box near the top of the dialog box should now say Select. You ought to see the name of the folder rooftop in the Select box.
        • Also, in the lower left corner it should say Select:rooftop
        • In the lower right corner, the Select button ought to be available.
      5. Click on the Select button.
    3. Leave all other settings as they are.
  8. Click OK to close the Site Definition dialog box.
  9. Then in the Manage Sites dialog box click on Done
  10. A message might pop up regarding cache. Agree to cache; it will enable Dreamweaver to control file management.

Top


Designating a Preview Browser

Dreamweaver makes it easy for you to see your html file in a browser. Even though Dreamweaver does a very good job of displaying what your pages will look like in a browser, you can never be really certain how your file will appear until you open it in actual browsers..

This can be particularly true with web pages that use what are called Cascading Style Sheets as well as JavaScript. Consequently, it is a good idea to make a habit of routinely seeing what your page actually looks like in one or more different types of browsers. That way you can be confident that your work displays the way you intended it to. You should check your page in a browser almost as often as you save your file, which ought to be done frequently in the event of a crash.

Let's make sure that you are set up in Dreamweaver for previewing your work in a browser easily. Note that this may already be properly set up in your copy of Dreamweaver, therefore don't be surprised if these settings have already been established:

  1. In the Dreamweaver menu bar select File -> Preview in Browser -> Edit Browser List
  2. The Preferences dialog box will open set to the Category of: Preview in Browser
  3. Click on the Edit button.
  4. The Edit Browser dialog box opens.
  5. In the Application field, click on the Browse button to navigate to your Internet Explorer or Firefox browser program, which you will probably find in a folder named something similar to Program Files on your C drive (Mac: Applications on the left side of a Finder window).
  6. Select the program, which will probably be named something innocuous such as iexplore.exe
  7. Then click OK.
  8. This will return you to Preferences with the Preview in Browser category selected.
  9. For Defaults: enable Primary browser
  10. Be sure to enable Options: Preview using temporary file.
  11. Click OK to accept the choices that you have made.

The Preview in Browser options allow you to preview your web pages in a wide variety of browsers, which is always a good idea. In order to do this you need to first have those browsers on your computer.

You can usually find downloads of older browser versions, but you may need to dig deeply because some publishers do not encourage the use of their older browsers, although they often provide them for web developers (like you!). The truly professional developers will also test on Macs and even UNIX/LINUX platforms using different operating system versions and browsers.

Now, using Dreamweaver's File menu, open the file basic.html. (If you are asked, agree to make the file Write-able, or see the Permissions section above.)

Press F12 on your keyboard (Windows) or Option-F12 (Mac).

This file ought to now open in your browser.

Top


Making an Image Into a Link Using the Properties Panel

Return to Dreamweaver.

Click on the image of the banner at the top of the page. You will be able to tell if the image is selected:

The Properties panel is what you will probably find to be the most useful part of Dreamweaver. The Properties panel changes depending on where the insertion point is or what is selected.

Make note that there is a little white triangle in the lower right corner of it. You may not see it if your monitor is still set to less than 1024x768 (see notes mentioned previously).

Click on the white triangle a couple of times. It allows you to expand or collapse additional options that may be available in the Properties panel. I recommend that you leave the Properties panel open to the largest size.

With the image selected, the Properties panel will offer options related to it. You will notice an empty Link box. Fill this in with the URL of a site you like. You need to include the transfer protocol (http://) at the beginning of the web address. For example, you might enter this:

http://www.google.com/

After you type in the URL, press on the Enter key (be forewarned that the page may all of a sudden shift to the left; that's OK). Use your scrollbars to return to viewing the left side of the page once again.

To the right of the Link box is a Target text field/drop down menu (it is not be available unless a link is typed into the Link field first). Targets are for controlling where the file specified by the link will open. Probably the most useful one is _blank. It's an odd name, particularly with the required preceding underscore. It causes the link to open in a new browser window. Select Target: _blank from the Target drop down menu (click on the checkmark icon on the right of the Target field).

Now click on F12 on your keyboard (Mac: Option-F12). This should open the page in your browser. If you move your pointer over the banner, the pointer will turn into a pointing hand icon, indicating the presence of a link.

Click on it. The link ought to open in a new window. When done viewing it, return to Dreamweaver.

Top


Library Item

Next, we will be creating rollover buttons and putting them in the small table in the vertical column on the left side of the page. We will not create links for these rollovers now, however the rollover effect will work. Links could be added later.

Then we will save the table containing the rollover buttons in Dreamweaver's Library. We do this because if we wanted to create any new pages for this site, many of them may be able to employ the navigation bar we will save in our Library. We would not need to recreate it for every page. Instead, we can literally just drag a copy of it out of the Library and put it on the page where we need it.

Furthermore, if we wanted to change anything about all of the uses (also called instances) of one library item, all we would need to do is to change the original library item file. Then all instances of it would change as well (our permission would be asked for first).

For example, when the time came to apply links to the buttons we are about to make, we would only need to apply the links to the buttons in the original library item file. Then all instances where the library item is used could be automatically updated to include the new links or any other changes that are made, all at the click of a button.

However, this would only modify the files in your local site, that is, on your computer. The files on the remote server would still need to be updated by copying the changed local files to the remote site using Dreamweaver's ftp utility.

Top


Rollover Buttons

When Dreamweaver creates a rollover image it is actually using two alternating images: the Original (normal) image and the Rollover image, which is the one that appears when a viewer moves their mouse pointer on top of the button. Note that the Original image is sometimes referred the Up image. As one might expect, the two images that are used need to be the same size.

Dreamweaver creates JavaScript code to make the rollovers work. We will now fill the four cells on the left side (they currently have text in them) with rollover images, inserting one rollover (two images: orig and over) per cell, using the instructions that follow. The order of the rollover buttons will be, top to bottom, as follows:

  1. catch
  2. gourmet
  3. rave
  4. special

Top


Here's How To Do It

  1. Click at the end of the text in the top cell, to the right of the period; it is the cell that has the text in it that says: put first rollover here (Catch).
  2. A flashing insertion bar should now be visible to the right of the words, as illustrated.
  3. Delete all the text in that cell. All that should remain in the cell is the insertion point.
  4. Execute these menu commands:
    Insert -> Image Objects -> Rollover Image
  5. In the resulting dialog box (the Insert Rollover Image dialog) leave the Image name as is. This is used by JavaScript but you don't need to be concerned with it for this exercise.
  6. For the Original image, click on the Browse button. Search for the navigation folder inside the images folder.
  7. From there, select the file: nav_catch_ORIG.gif
  8. For the Rollover image select nav_catch_OVER.gif
  9. Check the Original image and Rollover image entry boxes once you have selected the images.
  10. Enable Preload rollover image (it is probably already enabled).
  11. For Alternate Text enter "Catch of the Day".
  12. Note that a link to a local document can be added now (using When clicked, Go to URL), or it can be done later using the Properties panel.
  13. Click OK without filling in the other boxes.
  14. The rollover effect will not be visible in Dreamweaver except in Live View.
  15. Click on F12 (Option-F12 Mac) to test the rollover effect in the browser.
  16. Congratulations, you have just made your first rollover (and generated JavaScript code to go with it)!
  17. Follow this same procedure in the three remaining table cells, removing the text and any spaces from each cell before you insert the image rollovers specified in each cell.

Top


Making the Library Item

Next, we will select the part of the page that we want to convert into a library item namely, the navigation bar of rollover buttons that you just created including the table they are in. We will pretend that we will need to use it on multiple pages at our web site, including pages not derived from the template.

How do we select the navigation bar? It currently has two containers: a table (with the four cells) which is inside of what Dreamweaver calls an AP Div (AP = absolute positioning).

AP Divs use CSS (cascading style sheets) to define a specific location on a page, tables do not. Therefore, we want to select the table in the event that we may want the navigation bar in slightly different positions on different pages. If we save the AP Div code as a part of our library item and then used an instance of that library item, we would find that we couldn't move it once we put it on the page.

  1. To select the table that has the rollover buttons in it, and not the AP Div, first click on any of the button images that you just inserted (nested) inside the table.

  2. Then select the <table> tag in the Tag Selector area at the bottom of your file's window. The Tag Selector displays a row of html tags (see illustration). It is handy for easily selecting objects on the page that might otherwise be difficult to select.
  3. From the main menu bar select: Modify -> Library -> Add Object to Library
  4. This should open up the Assets panel.
  5. In the Assets panel, the Library group ought to be selected. It is the icon of a little open book at the bottom of the column of icons on the left edge of the Assets panel (see illustration).
  6. Your new navigation bar ought to be visible in the Library. The name of it (Untitled) should be highlighted, waiting for you to type in a name for it. Type in and name it navBar.

Dreamweaver will automatically create a new folder in the site root folder called Library and will put this library item in it using the extension: .lbi (library item).

Top


Create a Template

Next, we will make our page into a template so that we can easily create new pages based on it without having to totally assemble them. Our page is intended to be for displaying dinner specials. There may be many of these special dishes that you would want to have web pages available for. Using a template will make this much easier.

  1. From the main menu bar select: File -> Save as Template
  2. The Save as Template dialog box will open.
  3. In the text box labeled Description enter For daily specials.
  4. In the text box at the bottom that is labeled Save as name it: special.
  5. Click on Save.
  6. If you get an alert that asks: Update Links? - click Yes.
  7. Open the Assets panel by using the menu bar: Window -> Assets
  8. In the Assets panel, select the Template asset group. This is represented by an icon of a page of paper and is one icon above the Library's open book icon.
  9. If you don't see your new special template, click on the Refresh Site List button at the bottom of the Assets panel (see illustration) and it should appear.

Dreamweaver will save the template as a file with the file extension .dwt (DreamWeaver Template). Dreamweaver will also automatically create a new folder named Templates (that is, if one had not yet existed, and in your case it probably didn't) in your site's root folder and put your new template file in it.

The upper left corner of the template file (as it appears if the file is not maximized):

Top


Designate an Editable Region

Unless you specify areas of a Dreamweaver template to be editable, you will not be allowed to modify the files made from a template at all, with the exception of changing the page's html title (the text that appears in the title bar).

Therefore, you need to specify the parts of the pages derived from the template that you want people to be able to change. These need to be identified as Editable Regions.

In our template there are two areas that we would want to be able to modify in files derived from this template. Each is a table cell. The two cells are in the middle of the page, colored orange and very dark brown, and they have labels typed inside of them. To make them each editable, follow these steps for each of the two cells:

  1. We will start with the upper cell: click inside the upper (orange) cell.
  2. Select the furthest right <td> (cell) tag in the Tag Selector (the area at the bottom of the image window where you previously had selected the table tag). Be sure to open the window wide enough to see all of the tags - make sure you select the <td> tag furthest to the right.
  3. From the main menu bar select: Insert -> Template Objects -> Editable Region
  4. In the New Editable Region dialog box that opens, supply the name for the editable region: photo
  5. Click OK.
  6. Save the template file (File -> Save).
  7. Repeat the steps for the cell underneath it: the food description cell. Click anywhere inside that cell first, then follow steps 2 through 5, however name the lower editable region description.

Top


Making a File From a Template

Let's make a new file from the template just to make sure it works:

  1. From the main menu bar select: File -> New
  2. The New Document dialog box opens.
  3. Click on Page From Template in the left column..
  4. Your new template special should be listed in the right column..
  5. Select it.
  6. Click on Create
  7. When the new file opens you will see the NO symbol (a circle with a diagonal line through it) appear instead of an arrow almost everywhere your mouse pointer goes except over the two cells that you had made editable.
  8. Click inside the cell for the photo.
  9. Then click in the lower cell and type in your own description of a favorite dish of yours.
  10. Go to Modify -> Page Properties -> Category -> Title/Encoding.
  11. Enter the title: Your Name's First Dreamweaver Template Page - substituting Your Name with your actual name.
  12. Press on F12 (Option-F12 Mac) to preview the page in the browser.
  13. Check that the rollovers work.
  14. Save the new file in the html folder, saving the file with this name, replacing "yourlastname" with your actual last name: ROL_yourlastname.html
  15. Send only the html file to me via email, I do not need the images:
  16. Using this subject line:

Congratulations. That's it. I hope you enjoyed making rollovers, a library item and a template. This is what a final page from the template might look like if an image of food had been added:

Top


Copyright © 2012 Dan Vaughan and licensors. All rights reserved.