Logo

Home | Audio | DIY | Guitar | iPods | Music | Brain/Problem Solving | Links| Site Map

This work is licensed under a Creative Commons License.

Creating your first website – Part 3: Adding content to pages

Jon Varese

Adobe

Welcome to the third part of this article series on creating your first website. This tutorial shows you how to add content to web pages in Adobe Dreamweaver CS3. You can add many different kinds of content to web pages, including graphics, Adobe Flash files, Flash Video, and text—to name just a few. After you've added content to your pages, you can preview your work in a browser so that you can see what it will look like on the web.

Prerequisite knowledge:

Locate your files and review your task

In this tutorial, you'll begin with the table-based page layout (index.html) you created in Part 2: Creating the page layout. If you did not complete that tutorial, you can either complete it before proceeding or else open the finished version of the tutorial and begin with that.

The finished version of the tutorial, table_layout.html, is located in the completed_files folder, within the cafe_townsend folder that you copied to your hard disk in Part 1: Setting up your site and project files.

Note: If you begin this tutorial with the completed table_layout.html file from Part 1 instead of the index.html file from Part 2, some steps and illustrations in the tutorial will not match what you see on your screen.

Your task is to add assets to the home page for Café Townsend, a fictional restaurant. You'll learn how to add images, a Flash file, a Flash video file, and text. Figure 1 shows what the finished page will look like.

Final page after you have entered content into it

Figure 1. Final page after you have entered content into it

You'll notice that the text on the page is not yet formatted. That's because you'll learn how to format the text by using cascading style sheets (CSS) in the next tutorial.

You can find the required assets for this tutorial in the cafe_townsend root folder that you copied to your hard drive in Part 1: Setting up your site and project files. If you didn't complete that tutorial, you must do so before you proceed. The tutorial lets you know exactly where to find the assets as you go along.

Insert images

After you create your page layout, you are ready to add assets to the page. Start by adding images. You can use several methods to add images to a web page in Dreamweaver. In this section, you'll add four different images to the index page for Café Townsend using various methods.

Replace the image placeholder

  1. In Dreamweaver, open the index.html file that you created in Part 2: Creating the page layout.
  2. Double-click the image placeholder, banner_graphic, at the top of the page (see Figure 2).

    Double-clicking the image placeholder

    Figure 2. Double-click the banner image placeholder.

  3. In the Select Image Source dialog box, navigate to the images folder inside the cafe_townsend folder that you defined as your site root folder.
  4. Select the banner_graphic.jpg file (see Figure 3) and click OK.

     

    Figure 3. Select the banner_graphic.jpg file.

    Selecting the banner_graphic.jpg fileDreamweaver replaces the image placeholder with the banner graphic for Café Townsend (see Figure 4).

    Banner graphic for Café Townsend

    Figure 4. Banner graphic for Café Townsend

  5. Click once outside the table to deselect the image.
  6. Save the page (File > Save).

Insert an image by using the Insert menu

  1. Click once inside the third row of the first table—two rows below the banner graphic you inserted, just above the colored table cells (see Figure 5).

    Clicking inside the third row of the first table

    Figure 5. Click inside the third row of the first table.

  2. Select Insert > Image.
  3. In the Select Image Source dialog box, navigate to the images folder inside the cafe_townsend folder, select the body_main_header.gif file, and click OK.

    Note: If the Image Tag Accessibility Attributes dialog box appears, click OK.

A long, colored graphic appears in the table row (see Figure 6). This might look more like background color for the table cell than a graphic but if you look closely, you'll see that the graphic has rounded corners. The rounded-corner effect gives the lower portion of your page an interesting appearance after you've finished adding all of the assets.

Long colored graphic in the table row

Figure 6. Long, colored graphic in the table row

Insert an image by dragging

  1. Click once inside the last row of the last table on the page (just below the colored table cells).
  2. In the Files panel (Window > Files), locate the body_main_footer.gif file (it's inside the images folder) and drag it to the insertion point in the last table (see Figure 7). If you can’t see the full names of the files because of the width of the Files panel, you can hover the mouse pointer over files to display their names.

    Note: If the Image Tag Accessibility Attributes dialog box appears, click OK.

    Drag the body_main_footer.gif to the insertion point in the last table.

    Figure 7. Drag the body_main_footer.gif to the insertion point in the last table.

  3. Click once outside the table to deselect the image.
  4. Save the page by selecting File > Save.

Insert an image from the Assets panel

  1. Click once inside the center column of the three-columned table (the first table cell that is colored light tan).
  2. In the Property inspector (Window > Properties), select Center from the Horz pop-up menu and select Top from the Vert pop-up menu (see Figure 8). This aligns the contents of the table cell in the middle of the cell and pushes the cell's contents to the top of the cell.

    Selecting Center from the Horz pop-up menu and Top from the Vert pop-up menu

    Figure 8. Select Center from the Horz pop-up menu and Top from the Vert pop-up menu.

    Note: If you cannot see the Vert or Horz pop-up menus, click the expander arrow in the lower right corner of the Property inspector.

  3. Press Enter (Windows) or Return (Macintosh) once to create more space (see Figure 9).

    Creating more space

    Figure 9. Create more space

  4. Click the Assets tab in the Files panel, or select Window > Assets to make your site assets appear.
  5. Click the Images button to view your image assets (see Figure 10).

    Your image assets in the Assets tab

    Figure 10. Your image assets in the Assets tab

    Note: At this point you'll notice that your Assets panel contains many more assets than what is pictured in Figure 10. That's because the Assets panel is displaying all of the assets for your site, including the assets in the completed_files folder, which contains duplicates of all the site assets you're using right now. (Sorry, but there was no way to avoid this if I wanted to give you all of the completed versions of the files along with the starter files.)

    It is not necessary to do so, but if you want to get your Assets panel to match the screen shot, navigate to where you created the cafe_townsend site root folder on your hard drive, and drag the completed_files folder to another location on your computer. (You must drag it out of the site root folder so that it is no longer part of the site.) Then return to the Assets panel and click the Refresh button (the purple circular arrow at the bottom of the panel). When you refresh the panel, any assets that you removed from the site disappear from the list.

  6. In the Assets panel, select the street_sign.jpg file.
  7. Do one of the following to insert the street_sign.jpg file on the page (see Figure 11):
    • Drag street_sign.jpg to the insertion point in the center table cell.
    • Click Insert at the bottom of the Assets panel.

    Note: If the Image Tag Accessibility Attributes dialog box appears, click OK.

    Inserting the street_sign.jpg image

    Figure 11. Insert the street_sign.jpg image.

  8. Click once outside the table to deselect the image.
  9. Save the page.

About the Assets panel

You can use the Assets panel to view and manage assets in your current site. The Assets panel displays assets for the site associated with the active document in the Document window.

You must define a local site before you can view assets in the Assets panel. For more information, see Part 1: Setting up your site and project files.

The Assets panel provides two views:

When you click an asset in the Assets panel, the preview area displays the asset you selected. To change the size of the preview area, drag the line that separates the preview area from the asset column headings.

For more information, see Working with assets in Dreamweaver Help.

Insert and play a Flash file

Next you'll insert a Flash file that plays a photographic slide show of Café Townsend's featured food items. The Flash file you'll insert is a flexible messaging area file, also called an FMA. This is a common type of Flash application that displays an informational message to the audience. The message can change based on the needs of the business. For example, if Café Townsend is holding a special event, the FMA could easily change (without affecting the rest of the web page) to display information about the event, instead of the regularly featured food items.

To insert the Flash FMA file, you need to insert HTML code that embeds the file in the Dreamweaver page. The easiest way to do this is to insert the SWF file (the exported Flash content) into the page. When you insert a SWF file in Dreamweaver, it writes all the necessary Flash HTML code for you.

  1. With the index.html page open in the Document window in Dreamweaver, click once inside the second row of the first table.

    This is the table row immediately below the banner graphic you inserted in the previous section.

  2. In the Property inspector (Window > Properties), select Center from the Horz pop-up menu and select Middle from the Vert pop-up menu (see Figure 12).

    This places the contents of the table cell in the middle of the cell.

    Placing the contents of the table cell in the middle of the cell

    Figure 12. Place the contents of the table cell in the middle of the cell.

    Note: If you cannot see the Vert or Horz pop-up menus, click the expander arrow in the lower right corner of the Property inspector.

  3. Select Insert > Media > Flash.
  4. In the Select File dialog box, browse to the flash_fma.swf file (it's in the cafe_townsend root folder of your site), select the file, and click OK (see Figure 13). If the Object Tag Accessibility Attributes dialog box appears, click OK.

    Inserting the Flash media file

    Figure 13. Insert the Flash media file.

    A Flash content placeholder, rather than a scene from the FMA itself, appears in the Document window. This is because the HTML code is pointing to the SWF file, flash_fma.swf. When a user loads the index.html page, the browser plays the SWF file.

    A note about Flash files: When you build assets in Adobe Flash, you work in FLA files, the default file type for the Flash application. FLA files are designated by a .fla extension. For example, if you are working on an animated logo for a website, the file name of the Flash file might be animated_logo.fla.

    When you've finished working on a FLA file in Flash, you must export the file to a format that can be played on the web in Flash Player. When you export FLA files in Flash, they are converted to SWF files and designated by a .swf extension. SWF files (not FLA files) play Flash content in a web browser and are the file type you must insert into a web page that you are building with Dreamweaver.

    The Flash content placeholder should remain selected after you insert the SWF file, as long as you don't click anywhere else on the page.

    If it's not selected, select the Flash content placeholder by clicking it.

  5. In the Property inspector (Window > Properties), click Play (see Figure 14).

    Clicking Play in the Property inspector

    Figure 14. Click Play in the Property inspector.

    Note: If you cannot see the Flash Play button, click the expander arrow in the lower right corner of the Property inspector.

    Dreamweaver plays the Flash file in the Document window, showing you what site visitors will see when they view the page in a browser (see Figure 15).

    Dreamweaver playing the Flash file in the Document window

    Figure 15. Dreamweaver playing the Flash file in the Document window

  6. In the Property inspector, click Stop to stop playing the Flash file.
  7. Save the page.

When you save the page, Dreamweaver displays the Copy Dependent Files dialog box. This dialog box informs you that Dreamweaver has created a file called AC_RunActiveContent.js, and that the file must be uploaded to a server when you publish your web page. This file is necessary for Flash files to run correctly under certain browser conditions. Click OK to close the dialog box. If you click the Files tab in the Files panel, you’ll also notice that Dreamweaver has added a Scripts folder to your site root folder. This Scripts folder holds the AC_RunActiveContent.js file.

Eventually, when you publish your pages to a web server, it's very important that you upload this file in addition to any other dependent files in your site. Otherwise, your pages won't display properly when site visitors view them in certain browsers.

Insert a Flash video file

Next you'll insert a Flash Video file using the asset provided:

  1. With the index.html page open in the Document window, click once above the graphic that you placed in the center column of the three-columned table.

    In the previous section, you added some space before you inserted the graphic—this is where you should click (see Figure 16).

    Clicking once above the graphic that you placed in the center column of the three-columned table

    Figure 16. Click once above the graphic that you placed in the center column of the three-columned table.

  2. Select Insert > Media > Flash Video.
  3. In the Insert Flash Video dialog box, select Progressive Download Video from the Video type pop-up menu.

    A note about Flash Video: The Insert Flash Video command in Dreamweaver lets you insert Flash video content in your web pages without using the Flash authoring tool. The command inserts a Flash component, which displays the Flash video content you select—as well as a set of playback controls—when viewed in a browser.

    The Insert Flash Video command gives you the following options for delivering video content to your website visitors:

    • Progressive Download Video downloads the Flash video (FLV) file to the site visitor's hard disk and then plays it. Unlike traditional "download and play" methods of video delivery, however, progressive download allows the video file to start playing before the download is complete.
    • Streaming Video streams the Flash video content and plays it on a web page immediately. To enable streaming video on your web pages, you must have access to Adobe Flash Media Server (formerly Flash Communication Server), the only server that can stream Flash video content.

    For more information about using Flash video, see Adding Flash video content in Dreamweaver Help.

  4. In the URL text box, specify a relative path to the cafe_townsend_home.flv file: Click Browse, navigate to the cafe_townsend_home.flv file (located in cafe_townsend root folder of your site), and select the FLV file (see Figure 17).

    Specifying a relative path to the cafe_townsend_home.flv file

    Figure 17. Specify a relative path to the cafe_townsend_home.flv file.

  5. Select Halo Skin 2 from the Skin pop-up menu.

    A preview of the selected skin appears below the Skin pop-up menu. The Skin option specifies the look and feel for the Flash video component that contains the Flash video content. (For more information on how to select different skins for Flash Video components, see the Flash Video Topic Center.)

  6. In the Width and Height text boxes (see Figure 18), do the following:
    • In the Width text box, type 180.
    • In the Height text box, type 135 and and then click once inside the Message text box at the bottom of the dialog box. (You won’t be doing anything in the Message text box. You’re just clicking there to remove the insertion point from the Height text box.)

    Setting the width and height of the video

    Figure 18. Set the width and height of the video.

    Tip: You can click Detect Size to determine the exact width and height of the FLV file. Sometimes, however, Dreamweaver cannot determine the dimensions of the FLV file. In such cases, you must manually enter the width and height values.

    The value in the Width and Height text boxes specifies the width and height in pixels of the FLV file. You can adjust these values arbitrarily to change the size of the Flash video file on your web page. When you increase the dimensions of a video, the picture quality of the video usually decreases.

    Note: The "Total with skin" value shows the width and height of the FLV file combined with the width and height of the selected skin.

  7. Leave the default selections for the remaining options:
    • Constrain maintains the same aspect ratio between the width and height of the Flash video component (selected by default).
    • Auto play specifies whether to play the video when the web page is opened (deselected by default).
    • Auto rewind specifies whether the playback control returns to starting position after the video finishes playing (deselected by default).
    • Prompt users to download FP if necessary specifies whether or not you want users to see a download prompt if they don't have the necessary version of Flash Player required to play the video (selected by default).
  8. Click OK to close the dialog box and add the Flash video content to your web page.

    The Insert Flash Video command generates a video player SWF file and a skin SWF file that are used to display your Flash video content on a web page. (You may need to click the Refresh button in the Files panel to see the new files.) These files are stored in the same folder as the HTML file to which you're adding Flash video content (in this case, the cafe_townsend root folder). When you upload the HTML page containing the Flash video content, Dreamweaver uploads these files as dependent files (as long as you click Yes in the Put Dependent Files dialog box).

  9. Save the page.

Insert text

Now you'll add some text to the page. You can type text directly in the Document window or you can copy and paste text from other sources (such as Microsoft Word or plain text files). Later, you'll use cascading style sheets (CSS) to format the text.

Insert Body Text

In the Files panel, locate the sample_text.txt file (in the cafe_townsend root folder) and double-click the file's icon to open it in Dreamweaver.

You'll notice that this window is in Code view (see Figure 19) and cannot be switched to Design view (the view you've been working in until now) because the file is not an HTML file.

Code view of sample_text.txt

Figure 19. Code view of sample_text.txt

  1. In the sample_text.txt Document window, press Control+A (Windows) or Command+A (Macintosh) to select all of the text, and then select Edit > Copy to copy the text.
  2. Close the sample_text.txt file by clicking the X in the top-right corner of the document.
  3. In the index.html Document window, click once inside the third table cell of the three-columned table (the cell to the right of the column that contains the graphic and the Flash video).
  4. Select Edit > Paste.

    The text from the text file appears in the selected table cell (see Figure 20).

    Text appearing in the selected table cell

    Figure 20. Text appearing in the selected table cell

    Depending on your monitor resolution, the three-columned table enlarges to accommodate the text. Don't worry about how this looks right now. In the next tutorial, you'll learn how to use CSS to format the text so that everything fits in the table appropriately.

  5. Make sure the insertion point is still inside the table cell where you just pasted the text. If it isn't, click inside the table cell.
  6. In the Property inspector (Window > Properties), select Top from the Vert pop-up menu (see Figure 21). This aligns the text you just pasted to the top of the table cell. If you cannot see the Vert pop-up menu, click the expander arrow in the lower-right corner of the Property inspector.

    Selecting Top from the Vert pop-up menu

    Figure 21. Select Top from the Vert pop-up menu.

  7. Save the page.

Insert Text for a Navigation Bar

Next, you'll insert text for a navigation bar. However, the text won't look like a navigation bar until you format it in the next tutorial.

  1. Click once in the first column of the three-columned table (the column that is colored reddish-brown).
  2. Type the word Cuisine (see Figure 22).

    Typing the word Cuisine

    Figure 22. Type the word Cuisine.

  3. Press the spacebar and type Chef Ipsum.
  4. Repeat the previous step until you've entered the following words with a space between each one: Articles, Special Events, Location, Menu, Contact Us.

    Do not press Enter (Windows) or Return (Macintosh) when you type. Use only the spacebar to separate words and let the words wrap naturally (see Figure 23). The fixed width of the table cell determines how many words fit on a line.

    Using only the Spacebar to separate words

    Figure 23. Use only the Spacebar to separate words.

  5. With the insertion point still in the first cell of the three-columned table, click the td tag in the tag selector (see Figure 24).

    Clicking the td tag in the tag selector.

    Figure 24. Click the td tag in the tag selector.

  6. In the Property inspector (Window > Properties), select Top from the Vert pop-up menu (see Figure 25). This aligns the text you just typed to the top of the table cell.

    Selecting Top from the Vert pop-up menu

    Figure 25. Select Top from the Vert pop-up menu.

    Note: If you cannot see the Vert pop-up menu, click the expander arrow in the lower-right corner of the Property inspector.

  7. Save your page.

Create links

A link is a reference, inserted in a web page, that points to another document. You can turn almost any kind of asset into a link, but the most common kind of link is a text link.

You can create links at any stage of the site creation process. In this section, you'll create links for the navigation bar, even though you haven't formatted the text into the form of a navigation bar yet.

The cafe_townsend site root folder contains a finished HTML page that you can link to (a menu page for Café Townsend). You'll use this page for all of the links in the navigation, even though you would have distinct pages for each of these links if you were building a real site.

  1. With the index.html page open in the Document window, select the word Cuisine that you typed in the first cell of the three-columned table. Be careful to select the word Cuisine only and not the space after it (see Figure 26).

    Selecting the word Cuisine

    Figure 26. Select the word Cuisine.

  2. In the Property inspector (Window > Properties), click the folder icon next to the Link text box (see Figure 27).

    Clicking the folder icon

    Figure 27. Click the folder icon.

  3. In the Select File dialog box, browse to the menu.html file (which is in the same folder as the index.html file) and click OK (Windows) or Choose (Macintosh).

    Note: Be careful not to select the menu.css file by mistake.

  4. Click once on the page to deselect the word Cuisine. The Cuisine text is underlined and blue, indicating that it's now a link.
  5. Repeat the previous steps to link each word or set of words that you typed for the navigation. You want to create six more links: one each for Chef Ipsum, Articles, Special Events, Location, Menu, and Contact Us.

    Link each word or set of words to the menu.html page, and be careful to avoid the space before and after the words or set of words when you create your links. This is only a set of dummy links; in a real site, you would link each word in the navigation to its own distinct page.

    Note: Links don't work when you click them in the Document window in Dreamweaver; links work only in a browser. To make sure your links work correctly, preview your page in a browser. For instructions about how to do this, continue to the next section.

  6. Save your page.

Preview your page in a browser

The Design view gives you a rough idea of what your page will look like on the web, but you must preview the page in a browser to see the definitive end result. Although browsers produce the same results in general, each browser version can display HTML pages somewhat differently. Dreamweaver attempts to produce HTML that looks as similar as possible from one browser to another; sometimes differences can't be avoided, however. Thus, previewing your work in a browser is the only way for you to see what your site visitors will see after you publish your pages.

  1. Make sure the index.html file is open in the Document window.
  2. Press the F12 key (Windows) or Option+F12 (Macintosh).

    Your primary browser launches, if it's not running already, and displays the index page (see Figure 28).

    Primary browser displaying the index page

    Figure 28. Primary browser displaying the index page

    Note: Dreamweaver automatically detects your primary browser and uses it for previewing your pages. If the preview doesn't appear, or if it doesn't appear in the browser you expect, switch back to Dreamweaver (if necessary) and select File > Preview in Browser > Edit Browser List. When the Preview in Browser Preferences dialog box appears, add the correct browser to the list. For more information, click the Help button in the Preferences dialog box.

  3. (Optional) Switch back to Dreamweaver to make any necessary changes.
  4. Save your work and press the F12 key again to ensure your changes took effect.

You now have a web page full of content. The next step is to format some of the content to make it more appealing.

Home | Audio | DIY | Guitar | iPods | Music | Links | Site Map | Contact

Top

Creative Commons License