ColdFusion Tutorial

This ColdFusion tutorial is written for beginners and gives you an overview of the various components that make up the ColdFusion environment.

ColdFusion is an environment for creating web applications. To build applications, you first need to install the ColdFusion server. This ColdFusion tutorial will point you in the right direction.

Installation

You can install ColdFusion from disk or download it from the Adobe website. ColdFusion (at least the 2016 version) comes in the following editions: Developer, Standard, Enterprise, as well as an Express edition that enables you to run and test CF applications without installing the full program. The Developer edition is based on the Enterprise version but is limited to running on localhost and two other machines.

For more information see the installation tutorial.

The CF Administrator

The ColdFusion Administrator is a web interface that is automatically installed with ColdFusion. It provides developers with the ability to configure the CF implementation. Once you've installed ColdFusion, you can access the CF Administrator and configure it according to the needs of your website.

For more information see the CF Administrator tutorial.

Creating Applications

You create ColdFusion applications using CFML. You could use a plain text editor but an easier method is to use an editor such as Dreamweaver. Dreamweaver recognises CFML, so it can make life easier. For example, it color codes your CFML tags to make your code easier to read, it provides a CFML reference, it provides a CFML menu, wizards etc.

You save your files with a .cfm extension. When the user requests a file with this extension, the web server passes it to ColdFusion server to interpret. CF will then process all the CFML then send the result back to the web server. The web server then sends the resulting HTML page to the user's browser.

If you need an editor, try downloading the free CFEclipse (requires Eclipse first — also free), ColdFusion Builder, or Dreamweaver

CFML tags

Like HTML, CFML tags have an opening tag and closing tag. Most CFML tags' purpose are quite self explanatory. Some common CFML tags include <cfset>, <cfif>, <cfloop>, <cfquery>, <cfoutput>.

Example of CFML:

For more info see Adobe's full list of CFML tags.

CFML Functions

CFML provides a number of functions that you can use to perform logical and arithmetic operations and manipulate data. Common functions include DateFormat(), dateAdd(), ArrayNew(), NumberFormat(), IsDefined() and many more.

To view all CFML functions see Adobe's full list of functions

Connecting to a Database

Quite possibly, one of the most common things you will be doing as a ColdFusion developer is querying a database. To query a database, you need to do the following:

  1. Create a database
  2. Create a data source (via the ColdFusion Administrator) and point it to the database
  3. Query the database using CFML code. For example, something like this: <cfquery> tag. For example, something like this:

Verity

While it's true that you could provide your website users with search functionality using something like SQL, there is a more powerful alternative.

ColdFusion comes bundled with a third party search engine by Verity. This is a full text search engine that is well suited to searching unstructured documents. You can use Verity to search physical files (eg, Word, PDF, Excel etc) or the results of a database query. When the user performs a search, Verity searches "collections" (that you previously configured and indexed). Verity provides a number of operators you can use to manipulate the search results and these are generally available in the form of a CF tag.

To learn more about Verity check out Adobe's documentation.

Summary

This ColdFusion tutorial has provided an introduction to the main topic areas of ColdFusion. Specifically, we learned that you first need to install ColdFusion server. You then need to access the ColdFusion Administrator to configure your ColdFusion implementation. We saw a sample of the commonly used CFML tags and functions, learned how to connect to a database, and learned about the Verity search tool that comes bundled with ColdFusion.

Next Steps

Check out the more extensive ColdFusion tutorial.