Section 20.1. Pieces of the Puzzle

20.1. 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 require only 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 from your own computer with 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 20-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 .

Figure 20-2. Top: The technology behind a Web site that uses plain-old static HTML pages 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.
Bottom: When you come to a dynamic page, on the other hand, the Web server must communicate with an application server, which in urn communicates with a database server. The final results are sent back to you through the Web server.

You'll still be using a lot of HTML (and CSS) to build a dynamic sitefor example, to provide the layout, add banner graphics and navigation bars. But you'll augment this mix with some form of programming code. The 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 informationWeb 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.

Because dynamic Web sites require more technology, you can't just open a dynamic page in your Web browser 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 serve up dynamic, database-driven Web pages.

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

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 on Section 11.4.1.1 uses a combination of JavaScript and CSS 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 serverpages 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 11).

Dynamic Web sites, on the other hand, use server-side programsthose 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.


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 do things like search a database of products, view individual product pages, or add products to a shopping cart would be considered a Web application.

20.1.1. Understanding Server Models

In Dreamweaver lingo, the different application servers combine with a programming language to create a server model . 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 .

Each server model also works with one or more programming languages. For example, you can create an ASP page using either VBScript or JScript. In some cases, the server model understands only a single programming language: JSP pages, for instance, use the Java programming language, while PHP can refer both to a programming language named PHP and to the application server. Likewise, CFML, or ColdFusion Markup Language, is a programming language, and ColdFusion server is an application server. Essentially, an application server processes programming code and carries out various actions, like talking to a database or spitting out a Web page.

Which server model 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.

20.1.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 (for example, books and Web sites) to help you along. In addition, if you're working on Windows 2000 or XP Professional, you already have the software you need to get started: Internet Information Server (IIS).


Note: Windows XP Home Edition can't run IIS. Microsoft, of course, recommends upgrading to Windows XP Professional (ka- ching !).

IIS is a Web server that has a built-in application serverthe part that understands ASP code. In fact, it understands two different programming languages: VBScript and server-side JavaScript, both of which Dreamweaver speaks fluently. (Although you don't need to know either of these programming languages to get startedjust pick one and let Dreamweaver take care of the restyou'll 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 IIS software already set up on your computer, you'll find it on the installation CDs that come with 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's a better choice.

20.1.1.2. .NET

.NET is a newer 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. It hasn't taken off quite as rapidly as Microsoft expected, so 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 recognizes only 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.

20.1.1.3. ColdFusion

ColdFusion is a server application from Macromedia (the maker of Dreamweaver) that's programmed using CFML (ColdFusion Markup Language). ColdFusion 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 isn't free. You can download a developer's editiona free version that runs on your computerso you can build and test ColdFusion Web pages. But if you want to host the Web site on the Internet, you have to either buy the ColdFusion Server package (which isn't cheap) or find a Web hosting company that offers ColdFusion hosting. Fortunately, in recent years , more and more Web hosting companies have started offering ColdFusion as an option, at rates that are close to or match regular hosting plans.

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

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

20.1.1.4. JSP

JSP (Java Server Pages) is 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. Java 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 or PHP.

A widely used version of JSP is Tomcat, available at http://jakarta.apache.org/. It's open source (that is, polished by a worldwide population of volunteer programmers), free, and it works with the Apache Web server and many different databases.

20.1.1.5. PHP

PHP (PHP Hypertext Preprocessor) is a programming language that was created specifically for building dynamic Web pages. The PHP interpreterthat's the application serverworks 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 only understands MySQLanother free product available at www.mysql.com.


Note: PHP and MySQL are often coupled with Apache, the most popular Web server in the world. You can get this free Web server at www.apache.org. But to make installation of all of these technologies easier, XAMPP (www.apachefriends.org/en/xampp.html) provides a program for Windows, Mac and Linux that installs all of this software on your computer. This way, you can easily set up a testing environment on your desktop computer, so you can build PHP and MySQL-driven Web sites.

20.1.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 IIS to serve 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'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.)


Note: This section's tutorials are also available for the PHP/MySQL server model; you can find them at www.sawmac.com/dw8/.

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 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.

Fortunately, the tools Dreamweaver provides for the different server models are largely the same. Essentially, you build dynamic Web pages using the same techniques you've learned in the earlier sections of this book. For the heavy lifting (for example, retrieving data from a database or password protecting a Web page), you'll turn to Dreamweaver's menu-driven database tools to add the programming code necessary to make an application server do all the server-side magic needed to work with databases and generate dynamic Web pages. Once you learn Dreamweaver, you'll be able to build pages for any of the server models it works with.

FOR MACS ONLY
Mac OS X and PHP

When it comes to dynamic Web site production, Mac folks have often had to rely on others for help, because ASP, ASP.NET, and ColdFusion don't run on the Mac operating system. But since OS X is based on Unix, it can run many Unix-based programs, including the Apache Web Server, the PHP application server, and the 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 an easier way to get up and running: XAMPP is a complete package for installing Apache, MySQL, PHP and a bunch of other cool stuff (see www.apachefriends.org/en/xampp.html). As of this writing, the Mac version's still in beta, so it may have a few hiccups.

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




Dreamweaver 8[c] The Missing Manual
Dreamweaver 8[c] The Missing Manual
ISBN: 596100566
EAN: N/A
Year: 2006
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net