In early 2001, Macromedia acquired a company by the name of Allaire. With the acquisition, Macromedia also acquired a key server-side technology component named ColdFusion and the tool used to develop ColdFusion pages, ColdFusion Studio (now directly integrated into Dreamweaver). Described as a rapid server-side scripting technology for creating web applications, ColdFusion uses a language called ColdFusion Markup Language (CFML) to interact with databases and dynamically created pages. CFML tags are embedded directly into HTML, and each command has a start tag and an end tag similar to HTML. Each ColdFusion application is a set of pages with CFML commands in them. Developers can use the built-in functions, create their own, or integrate COM, C++, or Java components into their code. Now an essential technology in the Macromedia web development line, ColdFusion relies on the ColdFusion Application Server. After it's installed, the application server functions similar to the .NET Framework discussed in the previous sections) in that it closely monitors and manages ColdFusion web applications. Furthermore, you can use the ColdFusion Administrator, available as a standalone web application, to manage everything from data sources, memory usage, mail server properties, caching, error logs, and more. Installing ColdFusionAlthough ColdFusion isn't as straightforward an installation as ASP and ASP.NET are, it's still a fairly simply install. In fact, ColdFusion is available on the Macromedia Studio CD-ROM, Dreamweaver CD-ROM, or as a free 45-day trial from the Macromedia Website at http://www.macromedia.com/software/coldfusion. The following steps assume that you're using either the Studio or Dreamweaver CD-ROM to install ColdFusion:
Because ColdFusion is an application server, it runs as both a Windows service and a process. You can stop, start, or configure this service by clicking the Start button and then selecting Settings, Control Panel, Administrative Tools, Services. You can then select Macromedia ColdFusion MX Application Server and right-click the option to access specific commands such as Start, Stop, and Restart. The ColdFusion AdministratorAfter you've installed ColdFusion, you can set properties for the application server by using the ColdFusion Administrator. The ColdFusion Administrator allows you to perform administrative tasks for the application server, such as adding and configuring a data source, scheduling application page execution, configuring a RDS password, setting security settings, and more. You can access the ColdFusion Administrator by entering the URL http://localhost/CFIDE/Administrator. The first time you launch the administrator, you are asked to configure RDS access. TIP Remote Development Services (RDS) lets you access a remote ColdFusion MX server using HTTP. Using RDS, Dreamweaver users can securely access remote files and data sources, build SQL queries from these data sources, and debug CFML code. It's generally a good idea to configure RDS on development machines and to disable it on production machines. Because we'll be using RDS for the ColdFusion examples in the book, set the password now and click Next. The Administrator then runs through its final configuration process, installing ODBC drivers, sample applications, and more. When the configuration ends, you are redirected to the login screen. From here on out, whenever you access the administrator, you are taken directly to this page. To log into the Administrator, type the password you entered during the ColdFusion installation process (step 11 in the previous section). When you are logged in, you will see the myriad of modifiable settings similar to Figure 22.13. Figure 22.13. The ColdFusion Administrator allows you to configure various aspects of the ColdFusion Application Server.The ColdFusion Administrator allows you to configure the following aspects of the application server:
Creating a Simple ColdFusion PageNow that you've had a formal introduction to ColdFusion and the ColdFusion Administrator, let's walk through the process of creating a simple ColdFusion page. Not only will this process help familiarize you with the technology, it also gives you a basic understanding of how IIS works in conjunction with ColdFusion to process ColdFusion markup pages. To create a simple ColdFusion page, follow these steps:
TIP If you plan on trying out numerous server-side technologies, it's beneficial to create the folder with the Dorknozzle name followed by the three-letter server-side technology you plan to use. This convention prevents you from continuously having to redefine the site for every server-side technology. To test your work, open the browser and type the URL http://localhost/DorknozzleCFM/sample.cfm in the address bar. As you can see from Figure 22.14, two lines of text appear on the page. Figure 22.14. Two lines of text appear on the page. Some of this text is plain text parsed from <h1> tags in the browser. The date, however, is dynamically generated.Although this result may not seem all that awe inspiring, think again: You've just created your first dynamic web page using ColdFusion. Look at the code again and see whether you can pick apart the dynamic portions of the page. For the most part, 8 of the 9 lines in the page are plain old HTML that IIS does nothing with. It simply lets the browser parse the HTML tags and present the user with the text inside them. Line 7, however, works a bit differently: <h1>Hello it is: <cfoutput>#DateFormat(Now(), "MM/DD/YY")#</cfoutput></h1> In this case, we use a <cfoutput> tag to dynamically display the text Hello it is in a <h1> HTML tag. IIS, recognizing that this code render block exists, intercepts the request and calls for help from ColdFusion (processed using the jrun.dll located in the C:\CFusionMX\runtime\lib\wsconfig\1\folder by default). ColdFusion processes the request and interprets the <cfoutput> tag to mean "Output today's date using the standard MM/DD/YY format" onto the page. This response is sent back to IIS and ultimately back to the browser formatted using the <h1> tag. Although the process may seem complex, it happens so fast that a user rarely knows that a dynamic page is even being used. See how easy that was? In this example, we manually coded ColdFusion markup. The beauty in using Dreamweaver is that you don't have to code at all. Dreamweaver writes all the necessary markup for you. More on this later. For now, let's focus on getting our project configured so that we can use ColdFusion to create dynamic Dorknozzle pages. Configuring Dorknozzle to Run Under ColdFusionUp to this point, we've been working primarily from C:\Dorknozzle\<chapterfolder>. From now on, we'll work from C:\Inetpub\wwwroot\DorknozzleCFM (assuming that you're using ColdFusion). Because this is the case, we need to reconfigure the site definition to point to the new folder we've created. Furthermore, we need to configure the Testing Server category in the Site Definition window to provide Dreamweaver with information specific to the technology you plan on using for the defined site. To configure Dorknozzle to run under ColdFusion, follow these steps:
You're now ready to begin building dynamic Dorknozzle pages using Dreamweaver and ColdFusion! Using ColdFusion in DreamweaverDepending on the server technology you decide to use, features exposed in Dreamweaver's interface change. For the most part, however, you can bank on the fact that the following features are always available when working with any server-side technology, including ColdFusion:
Earlier, I mentioned that most of the dynamic functionality built into Dreamweaver is the same regardless of the server-side technology you decide to use. This becomes obvious with the Application Objects submenu in the Insert menu and the Application category in the Insert bar. The objects listed in these menus expose generic functionality that remains consistent regardless of server-side technology. What does change is the option below the Application Objects option in the Insert menu. This option (which varies from ASP Object, ASP.NET Objects, ColdFusion Objects, and PHP Objects, depending on which server-side technology you decide to use), displays specific content accordingly. |