Creating a component to be used as a navigation bar
A component is an HTML source file that stores text and objects, such as a navigation bar, that you want to add to multiple pages in a site. When a component is added to a page, it's added as a single object and remains linked to its source file. To update a component, you simply update its source file to have GoLive automatically update all pages containing it.
At the top of each page in the Gage Vintage Guitars site, you'll place the company logo and a navigation bar for the site. Instead of creating this page content multiple times, you'll create it once and save it as a component that you can quickly add to each page. Now you'll create a new page that you'll store as a component. You store components in the Components folder, located in the site's web-data folder.
- To display the right pane of the site window, click the double-headed arrow () in the lower right corner of the window.
If necessary, click the right pane of the site window. The Extras tab displays the contents of the site's web-data folder, which includes the Components folder.
- Place the site window at the bottom of your work area, so that the window is visible when you create a new page. To move a window, drag its title bar.
- Choose Window > Objects, or click the tab if the Objects palette is collapsed.
For more information on working with palettes, see “Creating a custom workspace” on page 78. For detailed information on using the Objects palette, see “Using the Objects palette” on page 83.
- In the Objects palette, click the Site button () to display the Site set of icons in the palette. (You can also choose Site from the Objects palette menu.)
Drag the Generic Page icon from the Site set in the Objects palette and drop it on the Components folder in the Extras tab
of the site window.
A new page, untitled.html, is added to the Components folder and appears in the Extras tab of the site window.
- Enter navbar.html to rename the file.
Now you'll open the navbar.html file.
- Double-click the navbar.html file to open it.
The navbar.html file opens in the Layout Editor of the document window.
Now you'll change the title of the page. Page titles, together with keywords, are used by Internet search engines and browsers to identify content in your pages.
- Select the default page title (Untitled Page).
- Enter Navigation Bar as the new title.
- Choose File > Save.
Now you'll begin designing the component by adding a layout grid to the page.
Adding a layout grid
GoLive layout grids make it easy for you to create table-based designs in your pages. Instead of setting up multiple table cells, you can add a single layout grid to a page and position objects anywhere on the grid with 1-pixel accuracy. You can easily add text to a grid by dragging a layout text box onto the grid and entering text into the layout text box.
- Click the navbar.html window to make it active.
Drag the Layout Grid icon from the Basic set () in the Objects palette to the page. (You can also double-click the Layout Grid icon to place a layout grid at the insertion
point on the page.)
A layout grid is added to the page. Now you'll specify a width for the layout grid.
- Choose Window > Inspector to open the Inspector, or click the tab if the Inspector is collapsed.
- In the Layout Grid Inspector, enter 600 for Width. Press Enter or Return.
To resize a layout grid, you can also select it and drag one of its handles.
Now that you've added a layout grid to the page, you can add objects, such as images, to it.
Adding an image using the pick whip button
When you create an image for use on the Web, you work in a program such as Illustrator or Photoshop, and then save the image in a Web-safe format such as GIF or JPEG. It's also a good idea to maintain the source file in its original format and resolution, in case you need to make changes to the image in the future. In GoLive, you can add Web-formatted images to the page using a variety of methods.
Now you'll add four Web-formatted images to the page using different methods. First you'll add a company logo using the pick whip button in the Image Inspector.
Drag the Image icon from the Basic set () in the Objects palette to the upper left corner of the layout grid. Don't worry about the exact placement of the placeholder;
you'll precisely position each image later in this lesson.
An image placeholder appears on the layout grid, and the Inspector changes to the Image Inspector. If needed, you can adjust the position of the placeholder, as well as any other object on the grid, by dragging it.
- In the Basic tab of the Image Inspector, notice that the Source text box shows “(Empty Reference!)” This indicates that the
image placeholder doesn't reference an image file yet.
Now you'll use the pick whip button to link an image file in the site window with the placeholder on the page.
- In the Files tab of the site window, make sure that the images folder is open and the logo.gif file is visible.
- Drag from the pick whip button () in the Image Inspector to logo.gif in the images folder within the site window.
The company logo is added to the page, and the path to the logo.gif file appears in the Source text box in the Image Inspector.
GoLive supports the use of low-resolution images that appear in the browser while high-resolution images are loading. You can generate low-resolution images quickly using GoLive, which you'll do now.
- In the More tab of the Image Inspector, click Generate. The image must be selected in the document window for this tab to
Now you'll add alternative text for the image. In browsers that don't support images or have image loading turned off, the text is displayed instead of the image. This text may also be used by text reading machines for the visually impaired.
- In the Basic tab of the Image Inspector, enter Gage Vintage Guitars Logo in the Alt Text box.
- Choose File > Save to save navbar.html.
Adding an image using a keyboard shortcut
Now you'll add a second image to the page using a keyboard shortcut. This image is part of the navigation bar for the site.
- Drag the Image icon from the Basic set () in the Objects palette to the right of the company logo on the page.
- Hold down Alt (Windows) or Command (Mac OS), and drag from the image placeholder on the page to items.gif in the images folder within the site window.
- In the Basic tab of the Image Inspector, enter Items in Stock in the Alt Text box to add alternative text for the image you just added.
Because items.gif is small in file size (1K), you don't need to create a low-source (low-resolution) image.
Adding images by dragging
Now you'll add a third and then a fourth image to the page by dragging. These images also are part of the navigation bar for the site. You don't need to worry about aligning these images perfectly; you'll do that in a later section of the lesson.
- Drag the Image icon from the Basic set () in the Objects palette to the right of the Items In Stock image on the page.
- Drag repairs.gif from the images folder in the site window to the image placeholder on the page.
- Click the newly added image in the document window to select it.
- In the Basic tab of the Image Inspector, enter Repairs in the Alt text box.
Now you'll add the fourth image to the page.
- Drag the Image icon from the Basic set in the Objects palette to the right of the Repairs image on the page.
- Drag appraisals.gif from the images folder in the site window to the image placeholder on the page.
- Click the newly added image to select it.
- In the Basic tab of the Image Inspector, enter Appraisals in the Alt text box.
- Choose File > Save to save navbar.html.
Aligning and distributing multiple objects
Now that you've added all of the images, you're ready to align and distribute them. You'll align the tops of the three images for the navigation bar using the Align palette.
- To display the Align palette, choose Window > Align.
- Click the Items In Stock image to select it. Then Shift-click the Repairs image and the Appraisals image to add them to the selection.
- In the Align palette, click the Vertical Align Top button () under Align Objects. (If the tops of the selected objects are already aligned, this button is dimmed.)
The tops of the selected images are aligned.
- With the three images still selected, click the Vertical Align Top button () under Align to Parent.
The three images are aligned with the top of the layout grid.
- Choose Window > Align to close the Align palette.
Now you'll move the three images together using a keyboard shortcut.
- Click away from the three images to deselect them, and select only the Items In Stock image on the page. Then hold down Ctrl+Alt (Windows) or Option (Mac OS), and press the Left Arrow key until the image moves no further.
- Select only the Repairs image on the page, and use the same method to move it to the left until it moves no further. Then
select only the Appraisals image, and move it to the left until it moves no further.
The selected objects are moved horizontally on the page so that their edges touch each other.
When you have finished placing objects on a grid, it's a good idea to optimize the grid, which you'll do now. Optimizing a grid reduces its size, so that it takes up less space on the page.
- Click the layout grid to select it. Then click Optimize in the Layout Grid Inspector.
For the purposes of this lesson, you won't add navigation links to the images. You'll add these links later in Lesson 6, “Creating Navigational Links.”
- Choose File > Save to save navbar.html. Then choose File > Close to close it.