Section 1.2. Comparing Static and Dynamic Sites


1.2. Comparing Static and Dynamic Sites

Dreamweaver distinguishes between static and dynamic web sites. A static site relies solely on client-side technology, while a dynamic site mixes client-side with server-side technology. This explanation begs a glaring question, namely: what's the difference between client-side and server-side technology? The answer to this one gets a little hairy, so feel free to skip ahead to "Meeting the Demands of Dynamic Sites" if you have little desire for a technical discussion.

TECHTALK

A static site relies solely on client-side technology, while a dynamic site mixes client-side with server-side technology.


For those still with us, the client/server distinction has to do with the way that computer networks operate. In any network connection, you have two pieces of software that talk to each other. One of these is the clientthat's the requesting software, the software that asks to see a particular file. The other is the server, the sending software, the software that pushes the file over the network in response to the client's request. In the case of the Web, the client software is the visitor's web browser, which runs on the visitor's personal computer. The server software runs on the computer that hosts the web site.

TECHTALK

In a computer network, the client requests a file, and the server sends the file to the client in response.


Client-side technology, then, pertains to the client sidethe requesting sideof the network connection. Everything that happens inside the web browser falls into this category. The browser requests HTML documents and displays them for you as visual web pages, presents page elements according to style rules, launches plug-ins, follows links, and executes scripts, so all of these are client-side functions. As long as it happens in the browser, it's on the client side.

TECHTALK

Client-side technology pertains to the requesting side of a network connection. If it happens in the browser, it's on the client side.


By contrast, server-side technology pertains to the server sidethe sending sideof the network connection. Server-side technologies come into play when you want to add information to an HTML document before it goes off to the client. Say that you're visiting an online bookstore, and you've packed your shopping cart full of this author's many excellent titles. You're getting ready to settle up, so you review the contents of your cart. Click goes your mouse pointer on the shopping-cart button, and your browser kindly requests the shopping-cart page from the web server. But before the server responds, the web site's ecommerce application intervenes, takes the basic shopping-cart page, and writes the particular items from your order into the HTML code. Upon completion, the ecommerce app hands your personalized shopping-cart page back to the web server. The web server then passes this page on to your browser, and you see your order in the cart, down to the last book, as Figure 1-4 shows.

Figure 1-4. The logic of a dynamic Cold Fusion site reveals a lot going on behind the scenes


TECHTALK

Server-side technology pertains to the sending side of a network connection. To write customized or visitor-specific information into a web page before the page goes to the client, you need server-side technology.


Now, getting back to static and dynamic web sites: a static web site relies solely upon client-side technologies, which means that the pages of the site don't require any special processing on the server side before they go to the browser, as shown in Figure 1-5. In other words, the pages are always the same for all visitorshence, the term static. A dynamic web site, then, is dynamic precisely because the same basic page goes out with different information depending upon which client makes the request. If you have 100 different visitors with 100 different shopping carts, then the server sends out 100 different variations of the shopping-cart page, each customized to match the visitor's specific order.

Figure 1-5. The logic of a static site is straightforward


Another common example of dynamic data in action is the ever-popular search feature. You know the drill: you type a few keywords into a text field, click a button, and get a page of results. If you're building this type of feature into your site, it isn't practical to create a separate results page for every possible combination of keywords you can think of, which would be the case with client-side technology alone. Depending upon the site, the results pages could easily number in the billions. But if you build the search feature by using server-side technology, you don't need a billion different results pages. One will suffice. The site compiles a list of results according to the visitor's specific keywords and then writes them dynamically into the page, which then goes off to the visitor's browser.

1.2.1. Meeting the Demands of Dynamic Sites

As you might expect, to build a dynamic site, you need a few additional pieces of software. All have the unfortunate name of server, which can very easily lead to confusion. To keep them straight, call them by their proper names: web server, application server, and database server.

A web server is software for responding to client requests over a network connection. Many times, the web server runs on a different computer than your personal machine, but this doesn't have to be the case. You can just as easily run a web server on the same computer as your web browser and Dreamweaver. Microsoft Internet Information Server (IIS) is one such personal web server that runs on Windows XP Professional. Apache is another very popular web server that runs on all operating systems, although the installation is on the technical side.

TECHTALK

A web server is software for responding to client requests over a network connection.


An application server or app server works in conjunction with the web server to process the server-side instructions on your pages. The files that make up a dynamic web site contain a mixture of straight HTML and server code. The server code explains what needs to be added to the page before it goes off to the client. When the browser requests a page, the application server checks to see if any customized content needs to be added. If so, the application server does its thing, replacing the server code (which the browser doesn't understand) with good old HTML (which the browser understands very well) and hands off the completed page to the web server for delivery to the browser.

TECHTALK

An application server or app server adds dynamic information to a web page before the web server sends the page to the client.


There are many different kinds of application servers, and each requires its own specific type of server code. Dreamweaver supports five of the most common app servers. Table 1-4 lists them.

Table 1-4. Dreamweaver-compatible application servers

App server

Server code

Macromedia ColdFusion

CFML

PHP Hypertext Preprocessor (PHP)

PHP

Microsoft ASP.NET

ASP

Microsoft Active Server Pages (ASP)

ASP

Java Server Pages (JSP)

JSP


Finally, a database server works in conjunction with your application server, enabling the app server to connect with an online database; e.g., products, user accounts, sales information, inventories, or whatever else you might want to store in this fashion. If your site can make do without a database, then you don't need a database server, but most dynamic sites use databases extensively and wouldn't be very dynamic without them. The app server can write information from the database directly into the pages of the dynamic site, which is the main incentive here. MySQL (pronounced "My Ess Que Ell") is an excellent database server that offers support for many different operating systems, including Mac OS X.

TECHTALK

A database server enables your app server to connect with an online database.


1.2.2. Respecting the Limits of Static Sites

Without server-side technology, the Web would be a very different place. There would be no search engines. No online shopping carts. No password-protected members-only areas. No customized front pages to match your preferences in news, sports, business, and weather. When many first-time web builders envision the site of their dreams, server-side technology figures largely in their thoughts.

While you can certainly build dynamic sites in Dreamweaver, this humble tome respectfully suggests that you make your first site a static one. Learning to build rock-solid, static pages without worrying about the subtleties of server-side code helps you to get a feel for the web-building process. You see exactly what the client side has to offer, which gives you a better understanding of the app server's role when you're finally ready to tackle dynamic pages.

Also, creating on the client side is easier. Because the HTML files of a static site are always the same, you don't have to do anything special in Dreamweaver to build them. You simply design them the way that you want them to look and then publish them to the Web. Even better, you don't need any special software to process your pages. Forget about the web server, the app server, and the database. To view your site, you need nothing more sophisticated than a web browser.

Unfortunately, this also means that you can't include any information on your pages that changes depending upon the visitor. If you need your site to take orders online, keep track of visitor preferences, create user accounts, and so on, you need the server-side support of a dynamic web site.

BEST BET

Make your first site a static one. Because so much happens behind the scenes on the server side, dynamic web sites can be challenging to build.


Remember, though, just because it's static doesn't mean that it isn't interactive. Dreamweaver's JavaScript behaviors give you plenty of interactivity just not visitor-specific interactivity. As long as your interactive features don't need to keep track of somebody's username, provide a shopping cart, or build results pages from database queries, you can create your site on the client side and conveniently avoid the technical headaches that are part and parcel of dynamic sites.

Besides, static or dynamic, your site's going to be great. You're the designer, after all.



Dreamweaver 8 Design and Construction
Dreamweaver 8 Design and Construction (OReilly Digital Studio)
ISBN: 0596101635
EAN: 2147483647
Year: N/A
Pages: 154
Authors: Marc Campbell

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