Previous Section  < Day Day Up >  Next Section

21.2 Pieces of the Puzzle

You may be thinking, "Yeah, that sounds fantastic, but so did that time-share in the Bahamas. What's the catch?"

The catch is that dynamic Web sites are more complex and require more technologies to get off the ground. Simple static Web sites only require the computer you use to build them and a Web server to dish them out. In fact, as you can see by previewing your site in a Web browser, you don't even need a Web server to effectively view a static Web site.

Dynamic Web pages, by contrast, require more (see Figure 21-2). Not only is there a Web server that handles requests for Web pages, there are also two other types of servers: an application server and a database server. And dynamic pages contain more than HTML; they also contain some form of programming code. An application server processes this code and sends a complete HTML page to the Web server, which, in turn, sends that on to the visitor. In many cases, the programming code requires the application server to retrieve information from a database and then merge it with the HTML of a page.

NOTE

In this context, a server is software that dishes out particular types of information梂eb pages, database queries, or the output of a program. It doesn't necessarily mean a separate computer; you can (and frequently do) have Web, database, and application servers all running happily together on a single machine.

The technology behind a simple Web site is straightforward: When you come to the site, the Web server sends your computer (the client computer) the Web pages, graphics, and other elements of the page. When you come to a dynamic page, on the other hand, the Web server must communicate with an application server, which in turn communicates with a database server. The final results are sent back to you through the Web server.
figs/21_02.jpg

Because dynamic Web sites require more technology, you can't just open a dynamic page on your own computer, before it's been posted online, as you can a regular Web page. You must view a dynamic page through a Web server that has an appropriate application server running.

It also requires setting up a database and connecting that database to your application server. Although this can be quite complex, it's not difficult to set up a basic Web server, application server, and database on your own computer. It's also easy to connect to other computers that are already configured to run dynamic, databasedriven Web pages.

And once you or your company's system administrator have set up the Web server and other assorted components, Dreamweaver MX 2004 can easily create complex Web pages that access databases and let you build powerful Web applications, all without ever learning any programming.

Even so, there are literally hundreds of combinations of Web, application, and database servers, and Dreamweaver doesn't work with all of them. However, it is capable of working with five of the most popular and powerful combinations, using seven different programming languages!

NOTE

The term Web application refers to Web pages that work together to complete a task. For example, code that builds pages that let visitors search a database of products, view individual product pages, and add products to a shopping cart would be considered a Web application.

FREQUENTLY ASKED QUESTION
The Dynamic Duo

How does a dynamic Web site differ from dynamic HTML?

Dynamic is a word that's thrown around a lot in Web circles, and it has a variety of uses.

For starters, dynamic sometimes refers to the power of JavaScript. For example, the Show Pop-Up Menu behavior discussed in Section 21.2 uses a combination of JavaScript and layers to make menus appear and disappear. The result is often called "Dynamic HTML," because the elements on the page change.

However, in this section of the book, dynamic refers to any Web page that's processed by an application server梡ages that undergo some form of transformation on the Web server's side of the Internet, like connecting to a database or collecting information from a form.

What's important to remember is that JavaScript, used for dynamic HTML and Dreamweaver Behaviors, is a client-side programming language. It runs in someone's Web browser and is limited to only a handful of actions, like mouse rollovers or any of Dreamweaver's Behaviors (Chapter 12).

Dynamic Web sites, on the other hand, use server-side programs 梩hose that run on an application server, out there on the Web somewhere. The visitors to your site never see the code, and their computers never have to run the program. They merely enjoy the results of the application server's hard work: a finished HTML page.


21.2.1 Understanding Server Models

In Dreamweaver MX 2004 lingo, the different application servers and programming languages are called server models. Dreamweaver recognizes several Server Models, including ASP and ASP.NET (pronounced "a-s-p" and "a-s-p dot net"), ColdFusion, PHP, and JSP. Each server model has its own set of unique requirements and its own methods of performing identical tasks.

Which one you use depends on which resources you have available: which type of Web server hosts your site, the operating system it uses, and which application server is available. For example, if you're hosting on Linux or Unix, you'll most likely end up using PHP; if you're hosting on Windows NT or 2000, meanwhile, you've already got access to ASP and possibly ASP.NET. It all comes down to what you have on your computer, what your company uses, or (if you're using a Web hosting service) what the host computer understands. Here's a brief description of each.

21.2.1.1 ASP

ASP (Active Server Pages) is one of the most common ways to start building database- driven Web sites. This Microsoft technology is well established, so you'll find numerous resources to help you along. In addition, if you're working on Windows 98, NT, 2000, or XP Professional, you already have the software you need to get started: Personal Web Server (PWS) on Windows 98 or Internet Information Server (IIS) on Windows NT, 2000, or XP.

NOTE

Windows XP Home Edition and Windows ME can't run Personal Web Server. Microsoft, of course, recommends upgrading to Windows XP Professional (ka-ching!).

Both PWS and IIS are Web servers that have a built-in application server梩he part that understands ASP code. In fact, it understands two different programming languages: VBScript and server-side JavaScript, both of which Dreamweaver MX 2004 speaks fluently. (Although you don't need to know either of these programming languages to get started梛ust pick one and let Dreamweaver take care of the rest梱ou will find many more resources for using VBScript with ASP pages. So if you plan to expand your knowledge of ASP beyond what Dreamweaver can do, you might want to use VBScript.)

If you don't have either the PWS or IIS software already set up on your computer, here's where to get them:

  • You can download Personal Web Server from Microsoft. There's an easy step-bystep tutorial (including a link to the download file) at www.asp101.com/resources/haneng/042199.asp .

  • IIS is included on the installation CDs of Windows 2000 and Windows XP Professional.

  • ASP can work with a variety of databases. For small projects, you can use Microsoft Access (the database program that comes with some versions of Microsoft Office), since it's fairly easy to use. For more demanding projects where lots of data needs to be stored and many users will access it, Microsoft's SQL Server is a better choice.

21.2.1.2 .NET

.NET is the newest Microsoft server technology. It's actually an entire suite of technologies intended to integrate many activities over the Internet.

ASP.NET is more advanced and more powerful than ASP, but also more difficult to learn. Since it's a relative newcomer, you'll find fewer teaching resources available to get started. ASP.NET can be programmed in numerous languages, including Microsoft's VB.NET, C# (pronounced "see sharp"), and JScript.NET, as well as more than 20 other languages. Dreamweaver MX 2004 recognizes both the C# and VB languages.

Like regular ASP, ASP.NET runs in conjunction with Microsoft's IIS Web server. You need to be running Windows 2000 or Windows XP Professional, and have IIS installed. You also need to install the .NET Framework, downloadable from www.asp.net .

Like ASP, ASP.NET works with many different databases.

21.2.1.3 ColdFusion

ColdFusion is a server application from Macromedia (the maker of Dreamweaver). It works in conjunction with several different Web servers, including IIS and Apache, and uses its own programming language, which resembles HTML. For this reason, some Web designers find it easier to learn than other programming languages.

The downside is that this application doesn't come cheap. You can always download a developer's edition梐 free version that runs on your computer梑ut if you want to host the Web site on the Internet, you have to buy the ColdFusion Server package, or find a Web hosting company that offers ColdFusion hosting.

The Developer Edition of ColdFusion comes with the Macromedia Studio MX package and is available for download at www.macromedia.com/software/trial_download/ .

Like ASP and ASP.NET, ColdFusion works with many different databases.

21.2.1.4 JSP

JSP (Java Server Pages) is a server language based on Sun's popular Java programming language. It requires a Java application server, like Macromedia's JRun server.

This approach is not for the faint of heart, however, since setting up a Java Server and connecting it to a database can be tricky. JSP is one of the more difficult languages to learn, too. If you don't have a knowledgeable guide, you're better off starting with a simpler technology like ASP.

A widely used version of JSP is Tomcat, available at java.sun.com/products/jsp/tomcat/ . It's open source (that is, polished by a worldwide population of volunteer programmers), free, and able to work with the Apache Web server and many different databases.

21.2.1.5 PHP

PHP (PHP Hypertext Preprocessor) is a programming language that was created specifically for building dynamic Web pages. It works in conjunction with a variety of Web servers including IIS, but was initially created for the Apache Web server. Like Apache itself, it's available as a free download for Windows, Mac OS X, or any flavor of Unix or Linux. Download it from www.php.net.

While PHP can work with a variety of different database servers, Dreamweaver MX 2004 only understands MySQL梐nother free product available at www.mysql.com .

21.2.2 Picking a Server Model

With so many choices, you're probably wondering which server model to choose. If you've never built a dynamic Web site before, are on Windows, and want to be operational as quickly as possible, your best bet is to start with ASP using a Microsoft Access database. You can create a database using Access (a relatively inexpensive program) and take advantage of either Personal Web Server (PWS) or IIS to run ASP pages.

In fact, since this is the easiest method, this book's tutorials will concentrate on building ASP pages. Once you get the hang of Dreamweaver MX 2004's dynamic Web-building tools, you can always try any of the other server models to build your sites. (However, switching a single site from one server model to another is difficult and not recommended.)

However, when you're building a real-world Web site, this decision may be out of your hands. You may be working for a company that's already using ColdFusion for its Web site. Or, if you've already got a Web site up and running but want to add some database-driven content, you'll have to use what's installed on that server. For instance, if your site is currently hosted at a Web hosting company, you should contact them to find out which operating system, Web server, and databases it uses. If they're Windows-based, odds are that they use IIS, meaning that you can use ASP and either Access or SQL Server databases. On the other hand, if they're a Unix operation, you'll most likely find the Apache Web server, PHP, and MySQL database.

FOR MAC USERS ONLY
Mac OS X and PHP

When it comes to dynamic Web site production, Mac users have often had to rely on others for help, because ASP, ASP.NET, and ColdFusion don't run on the Mac operating system. If you use Mac OS 9, there's only one way to use Dreamweaver's database features: Connect, via network, to a Windows machine that has those technologies already set up and running.

But if you're running Mac OS X, the news is much better. You can set up a complete database-driven Web development system right on your desktop. Since OS X is based on Unix, it can run many Unix-based programs, including the Apache Web Server, PHP application server, and MySQL database. In fact, Apache and PHP come supplied with Mac OS X; you can download the MySQL server for free from www.mysql.com/downloads/mysql-4.0.html .

If the very thought of Unix makes you squeamish, you can opt for a more user-friendly approach to installing MySQL: something called Navicat for MySQL, a commercial product, that includes a graphic interface for setting up and administering MySQL databases. You can download a free trial version at www.mysqlstudio.com/ .

You'll also find helpful instructions for setting up MySQL, PHP and Apache for Mac at the following sites:

www.macromedia.com/devnet/mx/dreamweaver/articles/ php_macintosh.html

www.entropy.ch/software/macosx/

www.phpmac.com


Fortunately, the tools Dreamweaver MX 2004 provides for the different server models are largely the same. Once you learn Dreamweaver, you'll be able to build pages for any of the seven server models it works with.

    Previous Section  < Day Day Up >  Next Section