Chapter 26. Introduction to Dynamic Dreamweaver




  •  Dynamic Web Sites and How They Work
  •  Getting Started with Dynamic Development
  •  Dynamic Development Tools in Dreamweaver MX
  •  Summary

Once upon a time, there was Dreamweaver and there was Dreamweaver UltraDev. If you've spent years happily using Dreamweaver to generate web sites that haven't required database connectivity, UltraDev was probably out there on the fringes of your consciousness, something you'd heard about but weren't quite sure what it was or how it related to the Dreamweaver you knew and loved. Dreamweaver UltraDev was regular Dreamweaver plus an additional set of tools, commands, and site options for connecting to databases and working with ASP, ColdFusion and other server technologies.

With Dreamweaver MX, UltraDev functionality has been folded into the main Dreamweaver program. Now, everybody has access to all the server-side tools, all the time. For those of you who haven't worked with UltraDev, that means a new category of Application objects in the Insert bar; several new panels, including the Database Explorer, Bindings and Server Behaviors; an extra category of Application Server choices in the Site Definition dialog box; and various odd little lightning-bolt icons throughout the interface (lightning = dynamic!).

Can you ignore all of this new functionality, and just continue using Dreamweaver as you always have, to create static HTML pages? Sure. But you might decide that now is the time to cross that new frontier, and learn what all the excitement's about with data-driven web sites.

This section of the book is for you if you're venturing into dynamic web development for the first time. This introductory chapter will start with an overview of what dynamic sites are, how they work, and what the various terms and technologies mean. Then we'll cover how to set up your workstation for dynamic development, and how Dreamweaver MX fits into the picture. Each of the remaining chapters in the section covers a particular server-side technology ASP, ASP.NET, ColdFusion, PHP and JSP with exercises for defining a site, connecting to a database, and building several simple kinds of pages.

How Should You Use This Part of the Book?

Probably the most overwhelming aspect of getting into dynamic web development is that all of the really hard work, and big decisions, must be done up front. Choosing a server technology, setting up a development workstation, installing and connecting to a database all must be done before you start building pages and "getting your feet wet."

If you're new to this whole field, start by reading the first section of this chapter, "Dynamic Web Sites and How They Work," to get an idea how all the pieces databases, web servers, application servers, drivers fit together. For each different server technology, examine the list of server and database requirements to see what kind of setup it will require.

Based on what you've read, decide what server technology you want to start learning. In the "Setting Up Your Workstation" portion of this chapter, determine whether you want to develop your sites locally (on your own computer) or remotely (by connecting to another computer). Determine what HTTP server and DBMS you'll need. Work your way through the sections that are relevant to you, setting up your workstation as you go.

Finish the chapter by reading the section on "Dynamic Development Tools in Dreamweaver MX." As you read, take a few minutes to go through the Dreamweaver MX interface, identifying the various dynamic development tools.

When you're all done with this chapter, turn to the specific chapter that covers the server technology you've chosen (Chapter 27, "Building a Basic ASP Site," for ASP, Chapter 28, "Building a Basic ASP.NET Site," for ASP.NET, and so on), and work through the exercises there. If you have some time on your hands, and you're not sure which technology to try, go through them all. You'll see that Dreamweaver tries to make the development process as similar as possible across technologies.

After you've done all that, you're up and running. Work on your own projects. Set new challenges for yourself. Go back through the other sections of this book, looking for the Dynamic Data sidebars they'll help you work with the dynamic aspects of all Dreamweaver tools. Your web sites will never be the same!

Dynamic Web Sites and How They Work

More and more as the web develops, increasingly complex data processing needs require more than just static, or hard-coded, pages. You want your visitors to be able to ask questions, place orders, get results immediately. You need absolutely current information posted at all times, without having behind-the-scenes humans constantly updating and uploading pages. In other words, you need web pages that can be generated and updated automatically, calling information as needed from a central source such as a database, and updating that source as visitors buy things, add their names to lists, and sign in and out. You need data-driven web sites.

Dynamic Versus Static Web Pages

A static web page is one that's completely created in advance, with all text and images in place, and housed on a web server to await a visitor coming to look at it. A dynamic web page, by contrast, contains placeholders for content that will be inserted by the server at the moment a visitor requests the page at "runtime" along with instructions to the server on how to construct the completed page. A look at how web pages are processed between the server and the browser will show you how this works.

How Static Web Pages Are Processed

Figure 26.1 shows the typical set of events in the life of a static web page. The page exists on the server. When a visitor clicks a link or types a URL in the address field, the browser sends a "request" in the form of the desired URL to the web server. The server software then finds the page and "responds" by sending it back to the browser. This is called the request-and-response model. The request is an HTTP request, using the http:// protocol to begin the URL; the web server software is also called the HTTP server.

Figure 26.1. The standard request-and-response process for static web pages.


How Dynamic Web Pages Are Processed

Dynamic data can enter into this equation in three main ways:

  • Server-side includes (SSIs)

  • CGI scripts

  • Database connectivity using application servers

Although the purpose of this section is to show you the third method, all three are covered here so that you can see how they relate.

Server-Side Includes (SSI)

The simplest kind of dynamic content and the easiest to understand is the server-side include, or SSI. An SSI is a placeholder that sits in an HTML document, containing instructions to the server to replace it with some dynamically generated data. The data inserted can be anything from a chunk of pre-defined code to the current date or time to information collected from processing a script or querying a database. The code for an SSI might look like any of the following:

<!--#include virtual="mydata.html" -->  <!--#echo var="DATE_LOCAL" -->  <!--#exec cgi="/cgi-bin/" -->

The HTML document containing an SSI is saved with a special filename extension typically.shtm or.shtml. to alert the server that SSIs are present.

Figure 26.2 shows the web page request-and-response process for an HTML page using SSIs. When the server receives a request for an SHTML document, it responds by finding any embedded SSIs in the page, executing their instructions, and inserting the resulting data in the document, which it then passes to the browser. Usually this involves substituting some real data (such as the date or time, or the even the contents of another file stored on the server) in place of the SSI placeholder code.

Figure 26.2. The request-and-response process for web pages that use SSIs.


CGI-Scripted Documents

A more truly dynamic web page can be created using CGI scripting to process browser requests and respond by saving user input, delivering web pages with filled-in placeholder content, and even building pages at runtime from collections of code snippets. Within the Dreamweaver model of web page construction, CGI is usually only used for processing simple form input. Chapter 11, "Working with Forms," briefly discusses CGI scripting.

For this discussion, you need to know only that CGI scripts (usually written in Perl) are stored in a special folder on the web server generally called cgi-bin. When a user fills out a form, the form action might contain the URL of a CGI script, like this (URL is in bold):

<form name="theForm" action=""  method="post">

Clicking the form's submit button will cause the browser to request the specified script, passing it the form variables as part of the URL or as an attached posting. Figure 26.3 diagrams the request-and-response process that ensues. The web server knows, because of the extension of the file that is called (.cgi, depending on how the server software is set up), that the requested page should not just be downloaded back to the browser. Instead, it finds the script and executes it.

Figure 26.3. The request-and-response process for web pages that access CGI scripts.


The script can do any number of things at this point:

  • It can email user input to a designated address, or save the information into a text file.

  • It can tell the server to respond by delivering a particular HTML page (like the Your Order Has Been Processed pages you get when shopping online).

  • It can insert text or images (that is, dynamic content) into the HTML page before telling the browser to deliver it.

  • It can even collect individual code snippets and assemble an HTML page on-the-fly, and then tell the server to deliver it.

Although this method is not as powerful or efficient for large-scale projects as using databases and application servers, it definitely creates dynamic, data-driven web pages. Figure 26.4 shows a web site built using a CGI script to read and write stored information and dynamically constructs pages.

Figure 26.4. The Sweet Lobster web site ( uses a CGI-based shopping cart to generate its pages, calling data from flat text files stored on the server.


Application Servers and Database Connectivity

The third and most powerful way to create dynamic web pages what this section of the book is all about is using databases to provide content, and special software modules called application servers to construct pages at runtime. Figure 26.5 diagrams the basic response-and-request process for this kind of dynamic content. Figure 26.6 shows a database-built web site in action.

Figure 26.5. The request-and-response process for web pages built using an application server and database connectivity.


Figure 26.6. The Philadelphia Inquirer web site ( was built and is maintained using a JSP-based application server with database connectivity.


The general procedure is as follows:

  1. The browser sends an HTTP request consisting of the URL for a document with a filename extension such as.asp,.cfm,.php, or.jsp.

  2. The web server software recognizes the extension and finds the requested page and activates the application server. This might be the Active Server controls built into Microsoft web servers, ColdFusion Server, Tomcat Java server, or the PHP module.

  3. The application server reads the document and either executes any scripts or interprets any custom tags it finds. These scripts and tags usually contain requests for some database information (place the contents of the Product Name database field from the Widget International database here, for instance) or instructions to change the database information (add John Smith to the Username database field in the Books Online database, for instance).

  4. The application server sends these requests and instructions collectively called queries to a database management system such as Access or MySQL, which finds the appropriate database and performs the requested actions. If any information was requested, it's sent back to the application server.

  5. The application server then constructs an HTML-formatted page, containing the requested information formatted according to the instructions in the originally requested document and sends the whole lot back to the web server.

  6. The web server returns this page to the browser.

That's how the process works. Now it's time to take a look at whom all the players are, and how they all need to fit together.

The Elements of Dynamic Web Pages

Obviously, setting up a database-driven web site involves a lot of variables and requires learning all sorts of new names and technologies. What HTTP server software will you be working with? What application server should you choose? What database management system do you need, and how much do you need to know about databases? The following sections examine the pieces of the puzzle one at a time.

The Server OS and HTTP Server Software

The web server itself is a computer, using some version of Windows, UNIX/Linux, or Mac OS as its operating system, running special web software for processing HTTP requests. The term web server in a discussion of dynamic sites that usually refers not to the computer itself but to the server software. This software is also called the HTTP server, to distinguish it from the application server (discussed in the section on "The Application Server," later in the chapter). The most common server software is described in the following sections.


Created and maintained by the Apache Software Foundation, Apache is the most popular server software today, installed on more than 50 percent of web servers worldwide. Apache is open-source software, and is therefore either free or very cheap to obtain; it's stable and powerful; and it runs on just about any operating system.

Internet Information Server

Microsoft's Internet Information Server (IIS) software is second only to Apache in popularity. It's powerful and flexible, although as a Microsoft product it will run only on servers using the Windows operating system (NT, 2000, or XP).

Personal Web Server

Microsoft's Personal Web Server (PWS) is a scaled-down version of IIS, originally built to provide Windows 95/98 computers with limited web publishing capabilities.

The Database

The heart of the data-driven web site is, of course, the database. For the system to work, there must be a database, and it must reside on the web server (or on a computer accessible to the web server). To create the database and work with it offline, you must have access to a piece of software called a database management system (DBMS). To make the database part of an online system, a DBMS must reside on the server.



To keep things simple, this discussion focuses on all the components for server-side data processing stored on one server computer. In fact, multiple networked computers might be involved. This won't change how the system works, however.

To author database-driven web pages online, you don't need to be a database expert. However, you do need to know at least how they store data, how to ask them questions and give them commands, and how to use drivers to communicate with them.

Hierarchical Data Storage

Databases store information in tables, as a series of fields (columns) and records (rows). Figure 26.7 shows a simple table structure at work. Adding a new customer to the database would add a new record, or row. Adding a new field, or column, would mean storing one more piece of information about each customer. This table structure is called hierarchical data storage.

Figure 26.7. Data stored in a hierarchical, or table, structure.


Relational Databases

Hierarchical information storage is fine as far as it goes, but it doesn't go far enough to handle complex information. The more sophisticated databases the ones generally used with data-driven web sites are relational databases, run by relational database management systems (RDBMSs). Relational databases offer features such as:

  • Multiple tables. A relational database that stores information in a series of tables, related by common key fields. Figure 26.8 shows the same information table shown in the previous figure, but with a second and third table added to store different kinds of data.

    Figure 26.8. Three related tables storing customer, order, and product data.


  • Primary and foreign keys. Keys create the relationships between the tables. Each table must contain one field designated as the primary key field, which contains a unique entry for each record. That enables you to call up a specific record by searching for the value in this field. Each table relates to the other tables by having its primary key present in the other table as a foreign key. As the dotted lines in Figure 26.8 show, the Customer ID and Product No. primary keys become foreign keys in the Order table, establishing the relationships between the tables.

Queries and SQL Statements

A database is useful only if you can find, update, and analyze information in it. You do this by using the database management system to query the database. How many people have ordered product J-9995 since January of last year? Is that more, or less, people than ordered the item the preceding year? What is the most expensive item ordered since March? When is the last time Moe Howard ordered anything? Sort the customer database by name, or by zip code, or by state. Raise all prices in the product database by 5 percent. The standard language used for querying databases is Structured Query Language (SQL). Hence database queries also are called SQL statements.



How do you pronounce SQL? Some database pros say "sequel." Others say it like they're spelling it, "ess-cue-ell." Take your pick. The first way is less of a tongue-twister.

Drivers (ODBC and JDBC)

Application servers communicate with database management systems through drivers pieces of software that define how to move information in and out of databases. The most common driver formats are the Microsoft Open Database Connectivity (ODBC) and the Sun Microsystems Java Database Connectivity (JDBC). A database management system that can connect using one of these formats is said to be ODBC-compliant or JDBC-compliant.

Standard DBMS Programs

To function as part of an online system, a database management system should be a relational database; must be able to run in whatever operating system is required by the server; must understand SQL statements; and must be compliant with ODBC, JDBC, or some other standard driver format. Common database management systems for online use are:

Microsoft Access, the most popular database program for general business use, is often used for small to mid-size online databases. Access isn't the most powerful DBMS around, however; its main limitation for online use is that it cannot accept large numbers of users trying to access it simultaneously. It is reasonably priced, however, and easily available as part of Microsoft Office. As a Microsoft product, it will run only on Windows operating systems, which means it cannot be used on UNIX, Linux, or Mac servers.

SQL Server is the big brother to Access, intended for large-scale sites with huge amounts of data and a significant number of simultaneous hits. This powerful program is expensive, and learning it is not for the faint of heart. Like Access, it runs on Windows only.

MySQL, a DBMS with its roots in UNIX, is a good alternative to Access if you are on a tight budget or not working on Windows. It doesn't have the same multiple-access limitations as Access, and is famous for its speed and stability and for being able to handle large amounts of data. But it is missing some of Access' advanced features, such as stored procedures. In its basic form, MySQL uses a command-line interface, so it might seem intimidating at first. However, several free GUI MySQL interfaces are available. Its learning curve is surprisingly gentle compared to Access. Depending on how you're using it, it's either free or cheap, and will run on Windows, UNIX, Linux, or Mac OS X.

PostgreSQL, sort of a big brother to MySQL, is the most advanced open-source DBMS available. It runs in UNIX-based environments, including Linux and now Mac OS X. For the non-Microsoft crowd, it's a good alternative to SQL Server.

Oracle, from Oracle Enterprises, is the most powerful database management system available. It's also not a program for small businesses or anyone on a tight budget. It's very expensive, and comes with a steep learning curve and very expensive authorized training. Oracle runs on Linux, UNIX, and Windows operating systems.



For more information on Access and SQL Server, visit To learn about (and to download) MySQL and PostgreSQL, visit and To learn about Oracle, visit

The Application Server (Middleware)

Databases, and database management systems, are a big topic but they're only half the story. The application server software functions as middleware, allowing communication between the browser and the DBMS. Choosing an application server is like getting married. You (and your client, and your company) are going to be up close and personal with this software on a daily basis, for a long time. You'll use the application server language to write your pages. You'll be limited by its limitations, and empowered by its strengths.


ASP is the acronym for the most popular application server today, Microsoft Active Server Pages. ASP is not an independent program or software module, like other application servers are. Rather, it's a functionality built into the Microsoft web server software (IIS and PWS). The language is script-based, using VBScript or JavaScript to formulate database queries and construct pages based on the results. A typical ASP statement looks like this:

<%  document.write("This is an ASP page.");  %>

Because it's part of the main Microsoft server technology, ASP operates only on servers running the Windows operating system. Chili!Soft offers a version of ASP for UNIX-based servers.

To perform the ASP exercises in this book, you'll need a Windows computer with either IIS or PWS installed and either Microsoft Access or MySQL for your database.


According to Microsoft, the .NET framework, which includes ASP.NET, is the new face of dynamic web development. Programs and scripts can be written in several languages, including Managed C++, C#, JScript and Visual Basic, and can be executed server-side or client-side. Live data pages can also be programmed to tie in with Microsoft's COM technology. ASP.NET offers many of the advantages of using Java/JSP (see the upcoming section on JSP), but strictly within the Microsoft fold. ASP.NET runs only on IIS web servers, and of course only on servers running the Windows OS.

To perform the ASP.NET exercises in this book, you'll need a Windows computer with either IIS or PWS installed, and either Microsoft Access or MySQL for your database. You'll also need the .NET framework (covered in Chapter 28).


Macromedia's ColdFusion has become a very popular alternative to ASP, largely because it uses a tag-based, rather than script-based, means of communicating with the DBMS. The core of ColdFusion functionality is ColdFusion Markup Language (CFML). Page elements can also be built using the CFScript scripting language. A typical CFML statement looks like this:

#myVar#  <cfset name="myVar" value="Welcome to ColdFusion!">

The application server portion of ColdFusion is called ColdFusion Server. It operates on servers running Windows, Linux, HP-UX, or Solaris, and must be purchased separately from any web server software. Because it is only available through commercial licenses, ColdFusion might not be the most immediately attractive choice for small businesses; but the speed of page construction possible using CFML makes the long-term development costs very reasonable.

To perform the ColdFusion exercises in this book, you'll need a Windows computer with either IIS, PWS, or Apache installed, or a Mac running OS X with Apache installed, and either Microsoft Access or MySQL for your database. You'll also need the ColdFusion server (covered in Chapter 29, "Building a Basic ColdFusion Site").


PHP (the recursive acronym for PHP: Hypertext Preprocessor) is a popular open-source alternative to commercial systems. Like ASP, its commands are script-based. Standard PHP code might look like this:

<?php  echo "This is a PHP page.";  ?>

PHP is available freely or cheaply, depending on its intended use. It has a large friendly user community supporting it, but no commercial guarantees behind it. PHP will work with Apache and Microsoft IIS web servers, and on UNIX, Windows, or Mac OS X operating systems. Unlike the other server technologies, PHP is database-specific. Not all installations of PHP will work with all DBMSs. Dreamweaver MX supports PHP for use with MySQL.

To perform the PHP exercises in this book, you'll need a Windows computer with either IIS, PWS, or Apache installed, or a Mac running OS X with Apache installed, and MySQL for your database. You'll also need the PHP application server module (covered in Chapter 30, "Building a Basic PHP Site").


JSP, or JavaServer Pages, is (as its name implies) a Java-based alternative to both ASP and ColdFusion. The application server is in the form of an applet called a container that resides on the server. Popular JSP containers include several commercial entries, such as Macromedia's JRun and IBM's WebSphere, as well as the popular open-source Tomcat. A typical JSP statement looks like this:

<%  out.print("This is a JSP page.");  %>

Because Java is by nature platform-independent (see Chapter 19, "Plugins, ActiveX, and Java," for more about Java), it will run on any computer that has Java virtual machine software. Because it's open-source, it's free, but can require more patience and skill to set up than prepackaged commercial software. Because JSP pages put all the considerable power of Java at the developer's fingertips, this is one of the more powerful application server technologies.

To perform the JSP exercises in this book, you'll need a Windows computer or a Mac running OS X. You'll also need the Tomcat HTTP and application server (covered in Chapter 31, "Building a Basic JSP Site").



To learn more about Microsoft ASP and ASP.NET, visit To learn more about ColdFusion, visit To learn more about JSP, visit To learn more about PHP, visit

Getting Started with Dynamic Development

After you understand the basic concepts and terminology of dynamic development, the next step is to choose whatever HTTP server/application server/database management system combo you want to work with and set up your workstation accordingly. You can set up your development environment in one of two ways:

  • In a "live" or "online" setup, all of the specialized software web server, app server, DBMS, driver is housed on a remote computer that you have FTP access to. This remote computer might even be the web server hosting your site. Developing live might seem easier to you, because it means you don't have to install any new software on your computer. But it's a cumbersome way to proceed. All of your configuration requests must go through the server administrator, which can slow you down; and you run the risk of actual web visitors trying to view pages that you are currently developing.

  • In an "offline" setup, you put all software elements on your computer including HTTP server software, DBMS, everything and temporarily act as hosting server and developer. When your site is fully developed, you move the relevant database files, drivers, and pages to the actual web server. This is how most developers work when they can. It's how we'll be proceeding in this book. An extra benefit of developing offline is that you get a free education about how server software works.

Based on which application server technology you want to set up for, what operating system you're using on your computer, and whether or not you want to work locally, follow the instructions in the different sections below. The instructions are divided into setting up a Windows computer for local development, setting up a Mac for local development, and setting up for remote development.

Setting Up Your Workstation for Development (Windows)

If you're using Dreamweaver MX on a Windows computer, you have many options for offline development. The most popular web servers, application servers, and databases will all run on Windows.



Note for Windows users: If you're planning to create ASP or ASP.NET pages, you need to install IIS or PWS as your HTTP server. If you're planning to work with ColdFusion or PHP, you can install IIS, PWS, or Apache. If you're setting up to work with JSP, you don't need to set up an HTTP server the Tomcat application server doubles as an HTTP server.

The HTTP Server: Internet Information Services (IIS)

If you're running Windows NT, 2000, or XP, the simplest and best HTTP server to install for development is IIS. The IIS software is on your Windows Install CD.

Windows XP, Windows 2000 (IIS 5)

To install IIS 5 into Windows XP or 2000, follow these steps:

  1. Insert the Windows Install CD.

  2. The CD should autolaunch. If it doesn't, go to Start > Settings > Control Panel > Add/Remove Software.

  3. In the window that appears, click Install Optional Windows Components.

  4. From the list of optional items, find and select IIS.

  5. Follow the instructions as they appear.

Windows NT (IIS 4)

To install IIS 4 into Windows NT, follow these steps:

  1. Install Windows NT 4.0 Service Pack 3 (if you haven't already).

  2. Install Internet Explorer 4.01 Service Pack 2 (if you haven't already).

  3. Install Windows NT 4.0 Option Pack (this installs IIS 4.0).

  4. Re-apply the latest Windows NT 4.0 service pack (the Option Pack overwrites some DLLs; this restores them).



It's entirely acceptable to install web server software on a computer that isn't going to be used solely as a web server. You probably don't want to be doing development work on a computer while that computer is open to the public for web browsing. But simply putting server software on the computer doesn't make that computer a dedicated server.

Install PWS into Windows 98

Note that PWS is not as powerful or problem-free as IIS. If you're running Windows 98, however, it's as close to IIS as you can get.

  1. Insert the Windows 98 Install CD.

  2. Go to Start > Run.

  3. In the command line window, type:


    In place of x, enter the letter of your CD drive.

  4. Click OK.

  5. Follow the instructions as they appear.

Using IIS and PWS

Both IIS and PWS install as services, meaning they will start up automatically when the computer boots. To access and configure IIS, go to Start > Control Panel > (Administrative Tools) > IIS. To configure PWS, go to Start > Programs > Accessories > Internet Tools > Personal Web Sharing.

  • Root directory: Each HTTP server designates a root directory for web pages that will be accessed and browsed using HTTP requests. For IIS and PWS, this folder is


    Any web document stored in this directory, or in any of its subdirectories, is "visible" to the web server for purposes of HTTP requests.

  • Browsing served pages: A browser passes an HTTP request to the server software by specifying the HTTP protocol followed by your computer's IP address or computer name, or the generic IP address ( or name (localhost) that computers use to refer to themselves. Any web document placed in the root directory can be requested:  http://localhost/myFiles/index.html  http://LauraComputer/myFiles/index.html

    All these addresses will find a page called index.html, stored in




    To get help using IIS, launch your browser and type http://localhost/iishelp in the URL field.

    Note that, though the effect might be similar looking, sending an HTTP request for a web page by entering in the browser's URL field is not the same as browsing the same page by double-clicking on it in Explorer or by entering c:\Inetpub\wwwroot\index.html in the browser's URL field. Only the former method invokes the IIS or PWS server.

  • Virtual directories: You can also create browseable web folders on your computer by declaring them as virtual directories within wwwroot. To do this:

    1. In Windows Explorer, right-click on the folder you want to share.

    2. From the contextual menu, choose Properties.

    3. Bring the Web Sharing tab to the front.

    4. Select Share This Item.

    5. The Edit Alias dialog box appears. Here you can set the following options:

      • Alias. This is an alternate name used for web access to your folder. Unless you're very familiar with web sharing and HTTP access, it's safest to leave the alias name and the folder name the same.

      • Access Privileges. You'll be uploading files to this folder, so you want to choose both the Read and Write access privileges. Leave the other privileges and settings at their defaults.

    A folder called OtherFiles, for instance, and stored on the D drive, can be declared a virtual directory with an alias name of OtherFiles. After this has been done, a request for will find the file page.html stored within this folder. Figure 26.9 shows a virtual directory being created.

    Figure 26.9. Creating a virtual directory for IIS or PWS by turning a folder's web sharing on.




For Windows 2000/XP, you can find your computer's name by right-clicking on the My Computer icon and choosing Properties from the contextual menu. You can find your computer's IP address by going to Start > Settings > Control Panel > Network Connections. Double-click on the Local Area Connection icon and bring the Support tab to the front. If your computer has been assigned a dynamic IP, this number might change from time to time.

The HTTP Server: Apache

If you're running on Windows, IIS and PWS are definitely your easiest choices. But they're not your only choices. Especially if you're working with PHP or JSP, preparatory to uploading to a UNIX server, you might want to more closely duplicate your eventual online environment by using Apache as your HTTP server. Apache is free, and should run on most Windows computers.

Install Apache for Windows

To install Apache for Windows, follow these steps:

  1. Download Apache for Windows from binaries/win32/. From the available file listings, find the version marked "current release". The file should be an EXE with a filename something like apache_1.3.23-win32-x86-no_src.exe. The version number might have incremented by the time you read this, but make sure you get the win32 version, with no source, and the file extension .exe.

  2. Quit any other server software (such as IIS or PWS) currently running on your system. You can do this by going to Start > Settings > Control Panel > (Administrative Tools) > Services. Find the server software in the list, select it and click the Stop link.

  3. Launch the Apache EXE file, and follow the installation instructions as they appear. Unless you're planning to run only Apache server software, and want it running all the time, don't choose to install it as a service. (This allows you to explicitly stop and start Apache as needed.)

Using Apache for Windows

If you didn't install Apache as a service, start it by going to Start > Programs > Apache HTTP Server > Start Apache in Console. This launches a command line window. As long as the window stays open, the server is running. To stop the server, close the console window.

Apache's root folder for serving web documents is

c:\Program Files\Apache Group\Apache\htdocs\

Any web document stored in this directory, or in any of its subdirectories, is "visible" to Apache for purposes of HTTP requests.

Send all HTTP requests to Apache by specifying the HTTP protocol followed by your computer's IP address or computer name, or the generic IP address ( or name (localhost) that computers use to refer to themselves. (To test Apache out, start it up and point your browser to http://localhost/. You should get the default Apache home page, as seen in Figure 26.10.)

Figure 26.10. The Apache HTTP Server default home page served from your local computer.




You can't have two servers responding to http://localhost or requests at the same time. This means you can't have both IIS and Apache running on your computer at the same time unless each of them is being accessed through a different port. If you want to learn more about setting port values, consult your IIS or Apache documentation. For purposes of getting yourself up and running as quickly as possible, it's easier to just remember to always stop one server before starting the other.

The Application Server

What application server, if any, you need to install depends on your choice of server technology. For ASP, you don't need to install anything other than IIS or PWS. For other servers, see the individual chapters following this one.

The DBMS (Database Software)

You can't serve pages built from databases unless you have the proper database management software (DBMS) on your computer. The easiest database software to develop with is probably Microsoft Access. But remember, eventually your dynamic site must be moved from your development computer to the web host for public consumption. If your dynamic web site will eventually be housed on a UNIX server, for instance, you'll probably want to do your development in a UNIX-friendly DBMS, like MySQL.

Microsoft Access is available by itself or as part of Microsoft Office Professional.

To learn how to obtain, install, and configure MySQL for Windows, see Appendix C, "Introduction to MySQL."



Remember, for PHP development with Dreamweaver, you must use MySQL.

The DSN (Driver)

After you've created your database, you must create a driver that allows the application server to talk to it. Each database you want a web site to connect to must have a driver of its very own. Your various projects employ 10 Access databases? You'll need 10 Access drivers. Each individual driver is called a data source name (DSN). To create a DSN for a database do the following:

  1. If you're working on Windows XP, go to Start > Settings > Control Panel > Administrative Tools > Data Sources (ODBC). If you're working on any other version of Windows, go to Start > Settings > Control Panel > Data Sources (ODBC).

  2. In the dialog box that appears, bring the System DSN tab to the front. This creates a DSN that anyone on the system can use to access the database. (Other choices are User DSN and File DSN.)

  3. Click the Add button.

  4. A new window will appear with a list of available drivers for different DBMs. Select the driver you need. If you're using Microsoft Access, choose Microsoft Access Driver (*.mdb). If you're using MySQL, and have installed the MyODBC driver, choose the MySQL driver (see Figures 26.11 and 26.12).

    Figure 26.11. Defining a DSN for an Access database.


    Figure 26.12. Defining a DSN for a MySQL database (MyODBC must be installed).




    If you're using MySQL as your DBMS, you need to use the MyODBC driver to create your DSNs. See Appendix C for full coverage of obtaining and setting up MyODBC.

  5. Depending on the kind of driver you chose, different windows will appear, requiring different information.

To set up a Microsoft Access driver (see Figure 26.11):

  1. Enter a name for the driver. It can be any one-word name with no special characters, and should be something you'll easily associate with the database the driver is for.

  2. Click the Select button and browse to the Access database this driver is for.

This is all the information you need to supply. Click OK to close the dialog box, and then OK again to close the ODBC control panel.

To set up a MySQL driver (see Figure 26.12):

  1. Enter a name for the driver. It can be any one-word name with no special characters, and should be something you'll easily associate with the database the driver is for.

  2. Enter the name of the database the driver is for. (You don't have to browse to the database because all MySQL databases are stored in one central location on your computer the mysql/data folder.)

  3. Enter the username and password (if any) that are associated with this database. If there is no required name or password, you can leave these fields blank.

This is all the information you need to supply. Click OK to close the dialog box, and then OK again to close the ODBC control panel.

Setting Up Your Workstation for Development (Mac)

Life is tough for Mac users; and setting up to develop dynamic web sites on a Mac is especially tough. There are fewer server software options, fewer driver options, and fewer databases available.

If you're still working on OS 9, you cannot use your computer as a local development workstation for dynamic sites in Dreamweaver. Your only choice is to connect to a remote server running Windows, UNIX or Mac OS X, for your development. (See the section on "Setting Up For Development on a Remote Computer," later in this chapter, for more on this.)

If you're using OS X, you have access too much of the UNIX-based database and web server software though you still must connect to a remote computer for work that requires IIS, ASP, or Access.

The HTTP Server: Apache (OS X)

The Apache HTTP server comes pre-installed with OS X. If you're running OS X, you have Apache. Be aware, however, that earlier releases of the OS X software included a "broken" version of Apache. To ensure that you have a functional version of Apache, make sure you have upgraded your system to 10.1.2 or higher. This will install Apache 1.3.22.

Starting and Stopping Apache

Though Apache is installed, by default it isn't enabled. To start the server, do this:

  1. From the Dock, launch System Preferences. When the System Preferences window opens, click the Sharing preferences icon.

  2. In the Web Sharing section, click the Start button to start web sharing (see Figure 26.13). Note that you need to be logged in as an administrator to do this.

    Figure 26.13. Starting web sharing in OS X launches Apache.


  3. When the window message indicates that web sharing is on, quit System Preferences.

After you have enabled web sharing, it will stay enabled even after the computer is shut down and restarted. To stop web sharing (for instance, to stop Apache), repeat the above procedure. A Stop button will replace the Start button if the server is currently running.

Using Apache

Apache designates a root directory for web pages that will be accessed and browsed using HTTP requests. The default directory is

(your hard drive)/Library/WebServer/Documents/

Any web document stored in this directory, or in any of its subdirectories, is "visible" to Apache for purposes of HTTP requests. The URL for the shared directory consists of the HTTP protocol followed by your computer's IP address, or the generic IP address ( or name (localhost) that computers use to refer to themselves. (See Figure 26.14.)

Figure 26.14. Browsing a user-defined web page in OS X with Apache.




In Mac OS X, the computer's IP address is shown in the Sharing preferences window (see Figure 26.13).

The Application Server (OS X)

You can set up your OS X Mac for local development using PHP or JSP. Both of these application servers come in Mac-friendly flavors. (See Chapters 30 and 31 for more on setting up these items.) For ASP or ASP.NET development, you'll need to connect your Mac to a Windows server. For ColdFusion development, you'll need to connect to a UNIX or Windows server with ColdFusion Server installed.

The DBMS and Driver

Access and SQL Server won't run on OS X, but there are other options. If you're looking for a free solution, MySQL and PostgreSQL are both available free. For a spiffier commercial solution, check out MacSQL at Figure 26.15 shows the free OS X MySQL at work. To learn how to obtain, install, and configure MySQL for Mac OS X, see Appendix C.

Figure 26.15. MySQL running in Mac OS X's Terminal utility.


Setting Up for Development on a Remote Computer

If you can't or don't want to set up your own computer as a development workstation, you can still create and preview dynamic Dreamweaver sites by connecting to a remote computer. The remote computer can be your web site's host, or any other computer you have network or FTP access to as long as it has HTTP server and application server software, a DBMS, and drivers. To set up for remote development, you'll need the following.

The Remote Computer's HTTP Address (URL)

Even if you're connected to the remote computer over a local network, you must know its URL to send HTTP requests to it so you can preview your data. If your remote computer is your web host, use your site's domain name. If the remote computer is simply another computer you're networked to, you'll have to get its IP address.

To learn the IP address of a Windows computer, launch the Command Prompt or DOS Prompt. At the prompt, type ipconfig and press Return. A whole set of numbers will appear, including the IP address.

To learn the IP address of a Mac running OS X, launch the System Preferences (its icon is in the Dock) and view Sharing preferences. The IP address is at the bottom of the window.

Read/Write Access to the Shared Web Folder

If the remote computer you're using for development is your web host, you already have FTP access to your published files. If you have local network access to the remote computer (for example, if you can connect to it from your computer without using FTP), you need to make sure you have read/write access to the folder where your files will be stored.

For Mac users: If you're connected to a Windows computer as your remote host, you'll need to establish FTP access to that computer even if you are connected over a local network, unless you have Mac/Windows sharing software such as PCMacLan or Dave installed. The remote computer must have FTP access enabled for the folder that will store your web files, and you must know the FTP address to access those files.

Correct Setup on the Remote Computer

The remote computer might be your web hosting company's web server, or it might be a computer under the administration of someone else in your office, or it might be all yours. Someone maybe you needs to create the setup spelled out in the previous sections of this chapter: the HTTP server, the application server, the DBMS, and the driver must all be present on that computer.

Dynamic Development Tools in Dreamweaver MX

Dreamweaver provides a full range of features to help you set up, program, and preview your dynamic web sites. The general procedure for working with live data pages in Dreamweaver is as follows:

  1. As part of defining a site, set up application server information (see Figure 26.16). The most important item of information here is the URL to be used when Dreamweaver sends HTTP requests for live data previewing. If you're developing locally, the URL should refer to http://localhost or If you're developing on a remote computer (whether or not you have local network access to it), the URL must be an absolute reference beginning with http://, such as that computer's IP address or your site's domain name.

    Figure 26.16. The Define Site dialog box showing the Testing Server category.


  2. As part of creating a new document, choose whether it will be a static or live data page, and what server technology and language the page will use (see Figure 26.17). Your choice here will determine what kind of server-side code Dreamweaver inserts into your document, and what objects and other choices you have available to you in the MX interface as you work on the document.

    Figure 26.17. The list of file types in the New Document dialog box, showing the different server models and languages.




    If you're upgrading from UltraDev 4, you might have noted that you no longer have to specify a server technology while defining a site. The server language can now be set separately for each document in a site, allowing you to mix server technologies and languages within a site.

  3. Use the Databases panel to set up a connection to an online database, and to explore that database (see Figure 26.18). Clicking the plus (+) button in this panel lets you choose a predefined DSN or (if you're developing locally on Windows) open the ODBC Data Sources window and define one on-the-fly.

    Figure 26.18. The Databases panel showing an exploratory view of a connected database.


  4. Use the Bindings panel to create SQL statements that will collect recordsets from the database to use in the page (see Figure 26.19). The SQL query can pull selected columns and selected records from a connected database, as well as sorting and grouping the information as needed. Only data from collected recordsets can be displayed in a live data page.

    Figure 26.19. The Bindings panel showing a selection of records collected from a connected database.


  5. Use Server Behaviors, Application objects, and dynamic input fields located throughout the Dreamweaver toolset to insert dynamic content from the record-set into the page, and control its appearance there (see Figure 26.20). As you can see, after the database connection is established and the recordset is collected, Dreamweaver gives you plenty of different ways to put the dynamic information on a page.

    Figure 26.20. Various options for inserting dynamic content placeholders.


  6. Use the Live Data View and Preview in Browser function to view the page with data from the database in place (see Figure 26.21). In Design view, each dynamic element displays as a placeholder good for working, but not for checking what your page will really look like when it's live. The Live Data button in the Document window lets you see real data elements in place while still working, though not all dynamic effects properly display here. To see a complete preview of the constructed page, use the standard Preview in Browser command (F12).

    Figure 26.21. Viewing Live Data in Dreamweaver and in the browser.



Do data-driven web sites sound exciting? Do they sound daunting? Are you ready to try them out? Each of the remaining chapters in this section focuses on getting up and running with a different application server. Chapters 27 and 28 introduce ASP and its powerful new cousin, ASP.NET. Chapter 29 helps you get started with ColdFusion. Chapter 30 gets you going with PHP. And Chapter 31 tackles JSP. In the course of each chapter, you'll learn how to configure and set up a site; how to link to a database; how to use data bindings, server behaviors, and live objects to create a page; and how to preview your results with the browser and with Live Preview.


Inside Dreamweaver MX
Inside Dreamweaver MX (Inside (New Riders))
ISBN: 073571181X
EAN: 2147483647
Year: 2005
Pages: 49 © 2008-2017.
If you may any questions please contact us: