Excerpt: Introducing ColdFusion
How ColdFusion Works Within the Client/Server Relationship
In the client/server relationship, ColdFusion resides on the server computer, running in conjunction with Web server software. It waits for a client to send a request URL that has the .CFM extension designating a ColdFusion template file, such as
and then goes to work. It momentarily seizes control on the Web server, does whatever is requested of it in the template file, and then gives the results back to the Web server to hand over to the magic fairies for delivery to the client.
Tip -- Most ColdFusion tags use opening and closing brackets just like HTML tags. For example, to designate a bold passage with HTML tags, you'd use a <B> before the relevant text and a </B&lgt to stop the bolding. ColdFusion uses the same characters to denote a beginning and ending tag, such as <CFQUERY> and </CFQUERY>.
When a ColdFusion server processes a template or .CFM file, it first looks for CFML tags. These may tell ColdFusion to search a database, to output some information, or to include a file (as in the earlier example).
You'll find a complete listing of ColdFusion 4.5 tags in Appendix B of this book, and I'll discuss most of them in depth in lessons to come.
Once a ColdFusion server examines the tags on a page, it begins executing the commands specified within the CFML tags.
One of the most common requests is a database search. To search efficiently, ColdFusion needs to have the database ready for access when requests come in. If each time the program received a request it had to open the database file, search the records, and then close the file, it would be hopelessly inefficient and unable to deal with multiple requests pouring in simultaneously.
ColdFusion works this out by requiring you to set up your database as an Open Database Connectivity (ODBC) source. An ODBC source sets up a data pipeline in and out of the database, making it readily accessible to ColdFusion.
Once a database is connected to ColdFusion via ODBC, developers can use a special set of commands, called structured query language, or SQL, to communicate with the database. SQL commands can be used to search a database, change the information within, or even to create new databases.
You'll look at SQL, datasources (DSNs), and ODBC in Days 3 through 5. For today, just marvel at the acronyms and sleep tight knowing you've covered the basic concepts.
Two guys, who wanted to save time on their Web coding, so they could do other stuff, created ColdFusion. By mastering the software and using it in your own Web projects, you too can save many hours of coding and remain free to venture into the daylight.
At the heart of the program is a database-to-Web gateway, a means of sharing database information with Web users. ColdFusion can take databases containing thousands of records and serve them up as individual Web pages via a single template file. It also handles input, allowing Web users to contribute to a database.
ColdFusion server is an ideal tool for business and organizations because it allows the creation of very large sites with a minimum design time. It features built-in security and commerce tools for those wanting to serve data selectively, or those who offer products or services for sale online.
Where can I get more information on ColdFusion before shelling out the dollars for it?
Allaire's Web site at http://www.allaire.com/ has extensive information on Web software compatible with ColdFusion, and a 30-day demo available for download. You might also try reading the rest of this book.
Does ColdFusion work with all database types?
Yes, pretty much. But knowing that there will be someone out there running some arcane office suite, I'd recommend checking the Web site for a current list of supported file formats. I'll cover databases in depth in Day 4, "Building a Database and Organizing Data," and Day 5, "Finding the Data You Need: An Introduction to Queries and SQL."
What about scalability? I have a huge product database and a Web site that gets thousands of hits per day.
Scalability is one of ColdFusion's biggest selling points. Right out of the box, it can handle everything from the simplest fan site to a huge database on a busy server. As you'll learn in Day 3, it also includes options to tailor its own performance to the capabilities of your server.
The workshop provides quiz and exercise questions to test your understanding of today's material. Answers to quiz questions can be found in Appendix A at the back of the text.
What is ColdFusion's primary function? Name two good uses for the program.
How does ColdFusion work with CGI scripts?
What is dynamic page generation?
How does a ColdFusion-driven Web page get from a server to a client?
Who was Elizabeth Taylor's most recent husband?
Check out Allaire's Web site and browse the Frequently Asked Questions (FAQ) section on ColdFusion 4.
Also on Allaire's site, check out some of the links to other ColdFusion-driven pages. Note some of the ways others use ColdFusion in their design and compare them to your own design needs.
Charles Mohnike is a technology writer and the co-founder of Zapt Digital Media, an electronic publishing firm.
Page 3 of 3