Chapter 14

Frames-Pages with Split Personalities


CONTENTS

Frames are a relatively new addition to the Internet scene. They were first introduced in Netscape 2.0, and soon many other browsers will support them. You cannot view frame sets directly in FrontPage, but the package includes an easy way to develop them.

What Are Frames?

You can think of a frame as multiple pages in one. They really are what the title of this chapter implies: pages with split personalities. Each region of a framed page displays a separate page that is scrollable, just like any other Web page.

Frames Terminology

Figure 14.1 shows a basic diagram of how frames and pages connect together. A frame set is a special kind of page that is divided into multiple sections, called frames. The page at the top of Figure 14.1 designates the frame set. You assign it a URL, just as you would any other page. The frame set gets loaded first when a user navigates to the URL. Next, the frame set loads the pages referenced by source URLs, and it displays each page in a separate frame.

Figure 14.1 : A simplified diagram of what a frame set does.

Each frame within the frame set has a source URL. Figure 14.1 shows three source URL pages on the second row. The navigation bar (navbar.htm), section 1 (section1.htm), and subject 1 (subject1.htm) load into the frame set when the user navigates to it for the first time.

For the source URL, use the name of the page that you want to display first in the frame. It can belong to a page, a file, or another frame set in your web. If one of the frames in the frame set contains another frame set, the initial frame is called a parent frame, or the master frame that displays another frame set within it.

Target frames are applicable when you create links from a framed page to another framed page. You must designate in the source frame's properties the frame in which the target page displays. To do this, assign a default target frame in the page properties of the originating page-that is, the page from which you are linking. The target frame is not the URL of the page to which you are linking. Instead, it is the name of one of the frames in the page, such as left, right, top, or bottom.

Take a look again at Figure 14.1. The frame set first loads into your browser, dividing the viewing window into three sections named topframe, left, and right. The source URLs then load into their respective frames.

The first source URL, the navigation bar, initially displays in the top frame. The navigation bar contains links to four section pages, indicated by solid lines in Figure 14.1. The navigation bar page also includes a default target link of left, indicated by a dotted line. This instructs the browser to load the linked pages in the left frame in the frame set.

The second source URL, section 1, initially displays in the left frame of the frame set. Each section contains links to different subjects, indicated by solid lines in Figure 14.1. Each section page includes a default target link of right, which displays the section's subject matter in the right frame of the frame set.

The third source URL, subject 1, initially displays in the right frame of the frame set. The subject pages do not need default target frames associated with them. When the user clicks links in the subject pages, the new subject matter appears in the same frame.

When to Use Frames

One frame, such as a navigation bar or a table of contents, is commonly used to link to other pages that display in another frame. This makes for easier navigation through a site. Instead of having to return with a link or the Back button in a browser as with standard web pages, the table of contents displays in its own frame while its links appear in another frame.

Frames also work well for an online book. The table of contents for each section of the book can appear in one frame, the content of each chapter in another frame, and footnotes for a page in yet another frame.

A formal presentation is another good candidate for frames. The outline of the presentation appears in one frame and the graphics in another. You can use a third frame in the set for navigation buttons.

Not All Browsers Are Frame-Compatible

Frames offer you great flexibility in displaying pages. Don't let your Web site rely totally on that flexibility, though. Many people use browsers that are not compatible with frames. Others use different browsers at different times for various reasons. For example, a user might prefer the way one browser views mail and newsgroups over another, and that choice might not have frame compatibility.

It is frustrating to browse the Web and find someone talking about a great site. You want to check it out, so you navigate to the page. A message pops up that reads, "Your browser is not frame-compliant. You cannot see this site unless you use a frame-compatible browser." It gives you no clue about which browser to use, and there is no way to exit out unless you use the Back button in your browser.

Be considerate to those out there who do not have frame-compatible browsers or who do not use them all the time. Provide alternatives for navigating to the pages that you display within the frames. Otherwise, you might potentially lose visitors to your site.

Creating Frame Pages

Because a frame set involves multiple pages that are linked together, you must have a web open to save the pages when they are created. Open a web in the FrontPage Explorer before you create pages with the Frames Wizard. You can select a predefined frame template, or you can design your own.

To create a frame set:

  1. Create or open a web in the FrontPage Explorer. The frame set and its associated pages are saved to this web after the wizard generates them.
  2. From the FrontPage Editor, select File | New. The New Page dialog box appears.
  3. From the list of available page templates and wizards, choose the Frames Wizard. The Choose Technique panel of the Frames Wizard appears. (See Figure 14.2.)

Figure 14.2 : Use the Choose Technique panel to choose a frames template or to design your own.

Creating Frames with Templates

Several frame templates have already been built for you. To use one of these predefined templates, select the Pick a Template option in the Choose Technique panel of the Frames Wizard. The steps are

  1. From the Choose Technique panel of the Frames Wizard, select Pick a Template.
  2. Click Next. The Pick Template Layout panel appears. (See Figure 14.3.)
    Figure 14.3 : Use the Pick Template panel to select a template.
  3. Select a frame layout from the list of options. As you make a selection, a preview of the layout appears on the left of the panel. Each frame in the frame set is labeled with a name. A description of the template also appears in the Pick Template Layout panel.
  4. After you choose a template, click Next. The Choose Alternate Content panel appears. (See Figure 14.4.) This is where you select an alternate page for users without frame-compatible browsers.
    Figure 14.4 : Use Choose Alternate Content panel to select a page that can be viewed with browsers that do not support frames.
  5. To specify an alternate page to display instead of the frame set, click the Browse button to choose another page in your web. If you do not already have an alternate page, you can create one and select it later. Use the HTML Page, Image, or Any Type tabs to choose an alternate page. After you make your selection, click Next. The Save Page panel appears.
  6. Enter the title of the frame set in the Title field.
  7. Enter the URL of the frame set in the URL field.
  8. Click Finish to create the frame set. The frame set and its associated pages are saved to the currently opened web.

The Frames Wizard Frame Templates

FrontPage comes with six frame templates. They are

Banner with nested Table of Contents
Main document plus footnotes
Navigation bars with internal Table of Contents
Top-down three-level hierarchy
Nested three-level hierarchy
Simple Table of Contents

Try to create one of the templates to find out how it works. You will learn a lot. The following sections describe what frame template produces.

Banner with Nested Table of Contents

The Banner with nested Table of Contents frame set generates four pages, as shown in Figure 14.5. They are

Figure 14.5 : The Banner with nested Table of Contents frame set displays three pages in separate frames.

Main Document Plus Footnotes

The Main document plus footnotes frame set generates three pages. They are

Navigation Bars with Internal Table of Contents

The Navigation bars with internal Table of Contents frame set generates five pages. They are

Top-Down Three-Level Hierarchy

The Top-down three-level hierarchy frame set generates four pages. They are

Nested Three-Level Hierarchy

The Nested three-level hierarchy frame set generates four pages, as shown in Figure 14.6. These pages are similar to those in the Top-down three-level hierarchy frame set, but the frame layout differs slightly. The pages are

Figure 14.6 : The Nested three-level hierarchy frame set displays three pages.

Simple Table of Contents

The Simple Table of Contents frame set generates three pages. They are

Designing Frame Grids

If the frame set templates provided with the Frames Wizard do not strike your fancy, you can design your own frame sets. Indeed, designing a frame set can help you better understand how frame sets and frames work.

Create or Import the Initial Source URL Pages

You need to create the frames that are initially displayed in the frame set before you use the Frames Wizard to create the frame set. Save these pages to the currently opened web. You do not have to worry about that for this project because the CD that accompanies this book contains pages for you to work with. This project builds an online book that is displayed in four different frames. Two frames are used as navigation links-one for navigating through the sections of the book and the other frame for navigating to other pages in the web that are not contained in the frame set. The third frame displays the contents for each section of the book. The fourth frame displays the chapter contents. These are simple pages with generic links that help you see how frames work together.

Build the Frame Set

Now you can build the frame set. The steps are

  1. Create an empty web in the FrontPage Explorer. The frame set and its associated pages are saved to this web after the wizard generates them.
  2. Import into your web the following files, which are located on the CD that accompanies this book. Use the File | Import command from the FrontPage Explorer. The first four files are the source URLs for the frame set. They are the pages that are initially displayed in the frame set when it is opened by the browser.

    File Content
    botbar.htm Bottom navigation bar
    topbar.htm Top navigation bar
    chap01.htm Chapter 1
    s1toc.htm Section 1 table of contents
    alttoc.htm Alternate table of contents for the frame set
    chap02.htm Chapter 2
    chap03.htm Chapter 3
    chap04.htm Chapter 4
    chap05.htm Chapter 5
    chap06.htm Chapter 6
    chap07.htm Chapter 7
    chap08.htm Chapter 8
    chap09.htm Chapter 9
    chap10.htm Chapter 10
    chap11.htm Chapter 11
    chap12.htm Chapter 12
    s2toc.htm Section 2 table of contents
    s3toc.htm Section 3 table of contents
    s4toc.htm Section 4 table of contents
    s5toc.htm Section 5 table of contents
  3. Open the FrontPage Editor and select File | New. The New Page dialog box appears.
  4. From the list of available page templates and wizards, choose the Frames Wizard. The Choose Technique panel of the Frames Wizard appears.
  5. Select the Make a Custom Grid option. Click Next. The Edit Frameset Grid panel appears. (See Figure 14.7.)
    Figure 14.7 : Design the frame set grid in the Edit Frameset Grid panel.
  6. Enter the number of rows and columns that you want in your frame set. As you make your selections, the preview in the left side of the panel updates to reflect your entries. Remember that these frame sets are displayed within the confines of a browser window, so don't add too many frames to the frame set. If you add too many frames, the user must rely too heavily on scroll buttons to see the contents of your frames. For this project, enter 3 for the number of rows and 1 for the number of columns.

    TIP
    Don't go overboard on the number of frames in your frame set. Keep in mind that some people browse the Web with low screen resolutions.

  7. To move the dividers between the rows, position the mouse in the preview screen and place the cursor over the divider line. Directional arrows appear. Move the divider toward the top edge of the page until the top section of the frame set is about one fifth or one sixth of the height of the page preview. Move the bottom divider line to about the same distance from the bottom.
  8. Shift+click to select the middle portion of the frame set in the page preview. The Split button enables. Enter the number of columns in which to split the middle portion. You can merge the split columns back together with the Merge button if you do not like how it looks. For this project, enter 1 for the number of rows and 2 for the number of columns.
  9. Move the vertical divider line between the two new columns toward the left of the page. This creates a larger area for the main content of the frame set, which should now look as it does in Figure 14.7.
  10. Click Next. The Edit Frame Attributes panel appears.
  11. Click the top frame in the frame set preview window. This frame includes links to all the section tables of content in the online book.
    When you pick the source URL for the page, click the Browse button to choose the page from the currently opened web, or type the source URL given in this step and in steps 14, 16, and 17 that follow.
    The margin width and height designate the size of the borders between frames. The scrolling setting determines whether a scroll bar is located at the left and bottom edges of the frame. It is generally a good idea to leave it set to Auto unless the page length is less than two or three lines of text. Likewise, in case the user has his browser window set to less than full screen, consider keeping the Not Resizeable option unchecked. This enables him to resize the frame windows to better fit his browser screen.
    Assign the following attributes to the top frame in the frame set, as shown in Figure 14.8.
    Figure 14.8 : Each frame is assigned a name, a source URL, and margin and border options.

    Attribute Value
    Name top
    Source URL topbar.htm (the top navigation bar)
    Margin Width 2
    Margin Height 2
    Scrolling Auto
    Not Resizeable Unchecked

    TIP
    Because the navigation bar contains only a single line of text, you can set scrolling to No if you want. Choose Auto if the contents of the frame are too large to display in the height of the frame. It is generally a good idea to leave the Not Resizeable field unchecked, in case the user wants to resize the frameset to fit a smaller window.

  12. Click the Edit button to edit the topbar.htm page. After the page opens in the FrontPage Editor, select File | Page Properties. The Page Properties dialog box appears.
  13. In the Default Target Frame field, located at the bottom of the Page Properties dialog box, enter the name of the frame that changes its content when the user clicks a link in this frame. This field is shown in Figure 14.9 with a frame name assigned to it.
    Figure 14.9 : The default target frame is the name of a frame-not of a file.
    For this project, the current frame contains links to the section's table of contents pages. These pages appear in the center left frame of the frame set. Enter cleft for the name of the default target frame.
  14. Click the center left frame in the frame set preview window. This frame displays each section's table of contents pages when the user clicks a link in the top navigation bar. When the user first opens the frame set, you want the contents of section 1 to appear in this frame. Each section contains links to its chapters and to bookmarks within the pages. Assign the following attributes to this frame:

    Attribute Value
    Name cleft
    Source URL section1.htm (section 1)
    Margin Width 2
    Margin Height 2
    Scrolling Auto
    Not Resizeable Unchecked

  15. Click the Edit button to edit the section1.htm page. In the FrontPage Editor, select File | Page Properties. Enter cleft for the name of the default target frame. This causes the correct chapter or subheading of a chapter to appear in the center left window when the user clicks a link in this frame.

    NOTE
    When you create a similar frame set of your own, you need to complete the Default Target Frame field for each page that is referenced in the links here. For example, all the section table of contents pages on the CD have their default target frames set to cright. Use the File | Page Properties command for each page to enter this value.

  16. Click the center right frame in the frame set preview window. This is the frame that contains the chapter content for the online book. When the user first opens the frame set, you want to display the first chapter in this frame. Assign the following attributes to it:

    Attribute Value
    Name cright
    Source URL chap01.htm (chapter 1)
    Margin Width 2
    Margin Height 2
    Scrolling Auto
    Not Resizeable Unchecked

    NOTE
    You do not need to specify a default target frame for any of these pages. When a user clicks any links that appear in these pages, the new page displays in the same frame. This enables you to create links between chapters.

  17. Click the bottom frame in the frame set preview window. Assign the following attributes to it:

    Attribute Value
    Name bottom
    Source URL botbar.htm (the bottom navigation bar)
    Margin Width 2
    Margin Height 2
    Scrolling Auto
    Not Resizeable Unchecked

  18. Click the Edit button to edit the botbar.htm page. In the FrontPage Editor, select File | Page Properties. Enter _top for the name of the default target frame.

    NOTE
    _top is one of four special names that are recognized by browsers. It causes the browser to remove the frame set and to display the referenced links from the bottom navigation bar in a full window. If you have pages in your web that are not displayed in frames, such as a home page, use this technique to exit the frame set. Place the _top default target frame on any page that contains links to pages outside your site.

  19. Click Next. The Choose Alternate Content panel appears.
  20. Use the Browse button to select the alternate table of contents for frame set page, or enter alttoc.htm.
  21. Click Next. The Save Page panel appears. (See Figure 14.10.)
    Figure 14.10: Assign a title and a URL for your frame set in the Save Page panel.
  22. Enter Chapter 14 Frameset as the title of frame set page. Assign chap14fs.htm for its URL.
  23. Click Finish to generate the frame set. The frame set page is saved to your web.
  24. Select File | Save All to update the source URL pages to save the default target frame values that you entered when you created the frame set.

Create the Alternate Content Page

Now you can generate the content of the alternate table of contents. Figure 14.11 shows a portion of the alternate page. It begins by mentioning that these pages appear in links. It also tells the user where to download a frame-compatible browser.

Figure 14.11: Begin your alternate page with a mention of where the user can download a frame-compatible browser.

As for the links on this page, you want to include links to the pages that do not have default target frames associated with them. If your alternate table of contents includes links to pages that have default target frames specified, the browser might load the page in a new window.

In the pages that you just completed, the chapters pages do not reference target frames. You can include them in the alternate table of contents. You also should add links to some of the other pages in your web and put copyright or footer information on the page.

It is easy to generate the content for this page. Copy the contents of each section page to the clipboard and paste them in the alternate table of contents page. Then mention that this table of contents was loaded because the user did not have a frame-compatible browser. Provide links to sites where the user can download a browser that can handle frames.

View the Frame Set

To see how your frame set looks, open a frame-compatible browser, such as Netscape 2.0. Enter a URL similar to the following, replacing the server name and web name with the one you created your frame set in:

http://localhost/yourwebname/chap14fs.htm

The browser loads the frame set. It should look like the one in Figure 14.12.

Figure 14.12: How your frame set actually looks.

This frame set does not have to be used for a book. Figure 14.13 shows the same frame set being used with graphics for the top and bottom navigation bars and an image map for the table of contents. As you can see, the content is all up to you.

Figure 14.13: The frame set that you created does not have to be used with a book. The content is up to you.

Name the Target Frames

When you design a frame grid, you assign each frame in the frame set a name, such as top, cleft, cright, or bottom. Typically, you assign a name that describes the frame's location in the frame set. Four frame names have special meanings. They are described in Table 14.1.

Table 14.1. Frame names with special significance.

NameDescription
_blankLoads the referenced page in a new window
_parentLoads the referenced page in the parent frame if the current frame is one that has a parent frame
_selfLoads the referenced page in the same window as the link
_topRemoves the frame set and displays the referenced page in the full browser window

Editing Frame Sets

You can edit a frame set after you create it. For example, you might want to remove, add, or rename frames. The steps are

  1. Use the File | Open from Web command to open the frame set from the FrontPage Editor. The Current Web dialog box appears.
  2. Choose the frame set, and click OK. The Frames Wizard appears again.
  3. To change the layout of the frameset, use the Edit Frameset Grid panel. Click Next to continue.
  4. To rename frames or to change other frame attributes, use the Edit Frame Attributes panel. Click Next to continue.
  5. To specify or change alternate content for your frames, use the Change Alternate Content panel. Click Next to continue.
  6. Save revisions to your web with the Save Page panel.
  7. To accept the changes that you made, click Finish in the Save Page panel. To discard the changes, click Cancel.

Choosing a Default Target Frame for a Page

You added default target frames to the frame set that you created in this chapter
while you used the Frames Wizard. You also can add or edit a default target frame. The steps are

  1. Open the page in the FrontPage Editor using the File | Open from Web command.
  2. Select File | Page Properties. The Page Properties dialog box appears.
  3. In the Default Target Frame field, enter the name of the default target frame.
  4. Click OK.

Loading Pages into Frames

It is possible to display another page in your web inside one of the frames in a frame set. The steps are

  1. Create a link to the page.
  2. Select the link, and choose Edit | Properties. The Edit Link dialog box
    appears.
  3. In the Default Target Frame field, enter the name of the frame in which you want the page to appear.
  4. Click OK. When the frame set is loaded in a frame-compatible browser, the page displays in the specified frame. If the frame set is not loaded, the browser may create a new window to display the page.

Displaying Clickable Images in Frames

If you have a clickable image, you do not necessarily have to assign a default target frame for each hotspot link that appears on the page. When you set the default target frame in a clickable image, you can use the Image Properties dialog box to assign a global default target frame. This means that all links in the clickable image that do not have target frames associated with them are associated with the global default target frame.

To add a default target frame to a clickable image:

  1. Select the clickable image.
  2. Choose Edit | Properties. The Image Properties dialog box appears.
  3. In the Default Link area, type the name of the default target frame in the Target Frame field, as in Figure 14.14.
    Figure 14.14: Assign a default target frame to a clickable image.
  4. Click OK to exit the Image Properties dialog box.

You also can add a target frame to a hotspot when you create it. Immediately after you draw the hotspot, the Create Link dialog box appears. Choose the Current Web tab, and specify the target frame, as in Figure 14.15.

Figure 14.15: You can specify a target frame in the Create Link dialog box.

Workshop Wrap-Up

You now know what frames are and what they do. It is time to hit the ground running and develop some frame sets of your own.

Chapter Summary

In this chapter, you learned how to give your pages multiple personalities by using frame sets. With the Frames Wizard, you designed a frame set and learned how to include page content in specified frames. You even learned how to use the same content for people who do not use frame-compatible browsers.

Next Steps

More challenging projects with frames await. In Chapter 17, "Real-Life Examples," you design a frame set into which you will insert multimedia content in Chapter 22, "Real-Life Examples."

Q&A

Q:
Can I put anything I want into frame sets?
A:
More or less, yes. You can insert picture presentations, animations, video files, Java applets, forms (such as those used in the discussion groups), and even links to your favorite sites. Exercise caution when you use links to other sites in your frame pages, however. When you include a link to a page on someone else's site, assign it a default target frame _top. Otherwise, the pages at the other sites are displayed in your frame set. This gives the illusion that the pages from the other sites are part of your site. The user will continue down the Net with those pages displaying in your frame. You can see what a mess that might cause.
Q:
When I divide pages into frames, how large should I make the graphics?
A:
The resolutions most commonly used when browsing the Web are 640 x 480 and 800 x 600, with the latter being most common. In 640 x 480 resolution, Netscape's viewing screen measures close to 626 by 278 pixels. I nternet Explorer's measures 610 by 312 pixels; release 3.0 will support frames. In 800 x 600 mode, Netscape's screen measures 786 by 398 pixels, and Internet Explorer measures 764 by 408 pixels. You can use these figures to estimate sizes for graphics. Alternatively, design your frame set and open it up in a frame-compatible browser. Using a screen capture program, take a screen shot of the frame set exactly as it appears in your browser at each resolution. That way, you can determine the exact measurements for your graphics. The hard part is deciding whether you want to design your graphics for 640 x 480 resolution or for 800 x 600 resolution. It is probably best to design for 640 x 480 resolution.
Q:
How many frames can I put in a page?
A:
As many as you want. Remember, though, that some users display pages at lower resolutions. You do not want to use so many frames that the content of your pages becomes unreadable. If your frame sets contain many sections, check them out at 640¥480 resolution before you put them on the Web.