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.
You can go about it in several different ways. 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, it's a good idea to create a testing server for storing and previewing dynamic pages in progress: a real Web server, application server, and database running on your own 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 15.2). 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 [see Section 15.3] is a good idea when you're working with a group of people on the same site.)
In the next four 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 .
You can browse static HTML files on your computer without any special software. But for dynamic data, you need a Web server and database server.
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 then double-click setup.exe .
After rebooting, open a Web browser and type http://localhost/ into the Address bar. You see the default page for the Web servera 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.
If you're on a Mac, you must connect, via a network, to a Windows machine that has been set up as described above. You can use the Mac's built-in file-sharing command (Go Connect to Server) to do so. (Alternatively, you can follow along with the PHP/MySQL tutorial online at www.sawmac.com/dw8/.)
To learn Dreamweaver's dynamic features, you'll be building a small Web application for the National Exasperator (see Figure 20-3). In fact, you'll turn the site's online store into dynamic Web pages that 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 www.sawmac.com/dw8/; click the Tutorials link to go to the tutorials page. Then click the appropriate link under the "Chapters 20, 21, 22,23 24: Dynamic Dreamweaver Tutorials" heading.
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 Exasperator ' 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 driveD:\, 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.
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:
Choose Site New Site .
The Site Definition window opens. Use Dreamweaver's Site Wizard to help you set up this new site.
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 .
Type Exasperator Store in the first box and http://www.nationalExasperator.com in the second box .
You've just told Dreamweaver the name you want to use while working on this site, and the URL of the Web site. In a real-world scenario, you'd type the address of your Web site.
Click Next .
The next screen lets you choose whether you're building a static or dynamic Web site.
Select "Yes, I want to use a server technology," and then choose ASP VBScript from the pop-up menu (see Figure 20-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.
Select "Edit and test locally." (See Figure 20-5.)
Dreamweaver provides three 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 preview the pages running on a real Web server, so you can immediately test out all the nifty dynamic stuff.
Use the other two options 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 you can't run a testing server on your computerfor example, if you're building ASP pages but you're on a Mac (see Figure 20-5).
You should use the last option when the testing server is on another computer, but you're the only developer working on the files. Since the files are available on your local network, anyone in your company or office who has access to the computer with the testing server can also edit those files. Your Web pages can end up in an unrecoverable mess if you and someone else are simultaneously editing and saving the exact same file.
The next step involves telling Dreamweaver where to find the files for the Web site.
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.
Type the URL of the test server in the box, and then click Test .
Dreamweaver may have already filled in this box. If the test server's 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. You can make this mistake when the folder following localhost in the URL is not actually on the Web server.
Click Next .
You may get a warning box squawking about how the URL doesn't match the testing server. This just means that in step 3 previously, you didn't specify any folder, but in step 7 you said the site was in a folder named nationalEx_root . This means site- root-relative links (see Section 4.1.3) won't work. In a real-world case, you'd probably have your site's files in C:\inetpub\wwwroot the real root folder of your local Web serverso you wouldn't run into this error. But since this is a made-up example, and you're using document-relative links (see Section 4.1.2), you're safe. So click OK to close the warning box.
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 and provide all of the information needed to move your site files to the Internet as described in Chapter 15. But since this tutorial is just an exercise, you won't be putting it up on a live Web server.
Click Done .
Dreamweaver has successfully set up your site. You're now ready to learn about databases and connect Dreamweaver to the National Exasperator online store database. (You may encounter the same warning from step 9; just click OK to dismiss it.)