Previous Section  < Day Day Up >  Next Section

21.3 Setting Up Dreamweaver for Dynamic Web Sites

Now that your head is spinning, and you're considering some noble career alternative like farmer, firefighter, or carpenter, it's time to set up Dreamweaver to work with an application server and database.

There are several different ways to go about it. One involves using what Dreamweaver calls a testing server. Remember how you can create a Web site on your own computer (the local site) before posting it online for all to see (the remote site) ? Here, the concept is similar. When building Web applications, it's again a good idea to keep all the "work in progress" pages on your own computer. After all, you don't want to fill up an active online database with test data, or put half-finished product pages on the Internet. But because dynamic Web sites require an application server and database, you can create a testing server for storing and previewing dynamic pages in progress: a real Web server, application server, and database running on your computer.

Then, when you've finished the site, you can transfer the pages to the remote site using Dreamweaver's built-in FTP feature (see Section 16.1.1). If you're working in a group setting with other Web developers, the testing server can be set up on a machine that's part of your group's local network. Each developer can then connect to the testing server and retrieve files to work on. (Using Dreamweaver's Check-In/Check-Out feature [Section 16.3] is a good idea when working with a group of people on the same site.)


You can always use your remote site as a testing server, as long as it has one of the application servers and databases that Dreamweaver offers. While this is an easy way to get started, you must contact your Web host to see what application server it uses and whether it can handle databases. In addition, you should have a fast Internet connection to the server. Otherwise, testing your dynamic pages may just test your patience.

Finally, whenever working on dynamic files directly on a live Web server, be aware that mistakes you make along the way may impact a database that's used by other dynamic pages. For example, if, while hurriedly trying to complete your Web site, you accidentally create a page that deletes records from your database, important information may no longer be available on your Web site. So whenever possible, the testing server should be separate from the server where the finished and perfected site resides.

In the next three chapters, you'll be building a dynamic Web site using ASP and an Access database. The concepts you learn will work for all of the other server models as well, though some of the details may be different. Significant differences among various server models will be mentioned where applicable.

21.3.1 Setting Up a Testing Server

You can browse static HTML files on your computer without any special software. But dynamic data requires a Web server and database.

If you're using Windows 2000 or Windows XP Professional, you must install IIS on your PC. To do so, insert your Windows 2000 or Windows XP Setup CD. If the setup program doesn't start automatically, browse to the CD and double-click setup.exe.


If you're using Windows 98, you must install PWS. Instructions and downloads are at .

After rebooting, open a Web browser and type http://localhost/ into the Address bar. You see the default page for the Web server梐 generic IIS welcome page. Voilà! A functioning Web server. But where are those Web pages kept? The root folder for your new Web server is C:\Inetpub\wwwroot\ on your PC.


ASP.NET note桾he tutorials also provide steps for using ASP.NET. If you wish to use the ASP.NET server model, download and install the .NET framework from (Windows XP Pro or Windows 2000 required).

If you're on a Mac, remember that you must connect, via network, to a Windows machine that has been set up as described above. If you're using Mac OS X 10.2 or later, you can use its built-in file-sharing command (GoConnect to Server) to do so. Otherwise, Dave from Thursby Software ( ) is one commercial software product that lets Macs network seamlessly with Windows machines.

21.3.2 Setting Up Dreamweaver

To learn Dreamweaver's dynamic features, you'll be building a small Web application for the National Exasperater (see Figure 21-3). In fact, you'll turn the site's online store into dynamic Web pages that will retrieve information from a database and merge it with already-created HTML code.

Before you begin building the page, download the tutorial files. As always, you can find them at ; click the Tutorials link to go to the tutorials page. Click the appropriate link under the "Chapters 21-24: Dynamic Dreamweaver Tutorials" heading, depending on the server model and kind of computer you're using. For example, if you're using ASP on Windows, click the ASP Windows link.

When the files have downloaded and decompressed, you should have a folder named DWDynamic on your computer, containing a folder called nationalEx_root (the root folder for this Web site) and a file called nationalEx.mdb (the Access database containing the National Exasperater's online store data). If you're having trouble, the Web site offers detailed instructions for downloading the files you'll be using with this tutorial.

To begin, move the nationalEx_root folder into the newly installed Web server's root folder. If you followed the directions above, the root folder should be located at C:\Inetpub\ wwwroot\. (If your Windows computer's main drive is not the C:\ drive, the root folder might be located on another drive桪:\, for instance.) Place nationalEx_root inside the wwwroot folder. To make sure you've set this up right, open a Web browser and type http://localhost/nationalEx_root/index.asp in the Address bar. If a Web page appears, your Web server is set up correctly.

Whenever you need to display lots of similar information, dynamic Web pages may be the answer. Dynamic pages at the National Exasperater online store list many different products. Because all the product information is stored in a database, the dynamic pages can display a list of products (top) and then individual product pages (bottom) by using the power of Dreamweaver's dynamic Web page building tools.

The first step in working on this dynamic Web application is to define a new site. The process of defining a dynamic site, as outlined below, is slightly different than for static sites, but not any harder:

  1. Choose SiteManage Sites.

    The Manage Sites window appears listing any sites you've already defined.

  2. Click New; from the pop-up menu, choose Site.

    The Site Definition window opens. Use Dreamweaver MX 2004's Site Wizard to help you set up this new site.

  3. If it isn't already selected, click the Basic tab at the top of the window.

    The first step is to give this new site a name.

  4. Type Exasperater Store and click Next.

    The next screen lets you choose whether you're building a static or dynamic Web site.

  5. Select "Yes, I want to use a server technology" and choose ASP VBScript from the pop-up menu (see Figure 21-4). Click Next to proceed.

    In the next step, you'll tell Dreamweaver where your local files are and where you intend to put the files for the testing server.


    ASP.NET note桟hoose ASP.NET C# instead.

    When building a dynamic site, you must choose one of seven different server models. There are actually only five different application servers, but since Dreamweaver lets you use two different languages for both ASP and ASP.NET, there are two server models for each of those application servers.
  6. Select "Edit and test locally" (see Figure 21-5).

    Dreamweaver provides four ways to work with dynamic Web page files and a testing server.

    "Edit and test locally" is a good choice when you've set up a Web and application server on your computer (as you've done in this tutorial). Essentially, this means that you're working on a Web site located on a functioning Web server. In this way, you'll preview the pages running on a real Web server, so you can immediately test out all the nifty dynamic stuff.

    Dreamweaver provides different ways to work with dynamic Web page files on a testing server. If you don't have a working Web server on your computer, but do have an account with a Web hosting company that recognizes one of Dreamweaver's server models, you can use that server to test your files. Choose the last option: "Edit directly on remote testing server..." You can then connect to the server using FTP, as described in Section 16.1.1. Although this method takes longer, since you must constantly upload and download files over your Internet connection, it's one way to get going with dynamic Web sites.

    The next three options are used when the testing server is located on another computer. This may be a computer on your local network, or a full-fledged Web server running on the Internet that you connect to using FTP.

    "Edit locally, then upload to remote testing server" is a good option when working with other designers. It lets you use Dreamweaver's Check In and Check Out features (see Section 16.3) to work on the site, so that you won't accidentally overwrite other people's hard work when you transfer files back and forth between your computer and the test server.

    The last two options should be used when the testing server is on another computer, but you're the only developer working on the files. The only difference between the two is the method you use to connect to the testing server: either a local network or FTP.


    If you're a Mac user who's following along with this tutorial, and you've set up a Windows machine to act as a testing server, choose "Edit directly on remote testing server using local network." Your Mac must be networked to the Windows server for this to work (see Section 16.1.2).

    The next step involves telling Dreamweaver where to find the files for the Web site.

  7. Click the folder at the right side of the middle of the window; navigate to and select the nationalEx_root folder on the Web server. Click Next.

    The nationalEx_root folder is probably at C:\Inetpub\wwwroot\nationalEx_root\. You've nearly completed the setup.

  8. Type the URL of the test server in the box and click Test.

    Dreamweaver may have already filled in this box. If the test server is running on your computer, the URL begins with http://localhost/ and ends with the folder that contains the Web pages. In this case, the URL is probably http://localhost/ nationalEx_root/.

    If you get an error message when you click Test, you've probably entered the wrong URL. This can happen when the folder following localhost in the URL is not actually on the Web server, or if you forget to add the trailing / at the end of the URL.

  9. Click Next. Click No, and then click Next one more time.

    If you were planning to move this site onto a Web server connected to the Internet, you would select Yes at this stage. But since this tutorial is just an exercise, you won't be putting it up on a live Web server.

  10. Click Done.

    Dreamweaver has successfully set up your site. You're now ready to learn about databases and connect Dreamweaver to the National Exasperater online store database.

    Previous Section  < Day Day Up >  Next Section