Cold Fusion Basics SEARCH

Cold Fusion has been growing in popularity since its inception in 1995 when it was introduced by the Allaire Corporation (which is now owned by Macromedia). Today, it is used by more than half of the Fortune 500 companies. It's popularity comes from its ease of use and extensive capabilities, including working with databases; interacting with the Internet through FTP, e-mail, and HTTP; and much more.


Quick Notes about Cold Fusion:
- Cold Fusion and ASP cannot be enabled for the same account.
- Cold Fusion can work with any ODBC compliant database as long as it has been converted into the MySQL environment. For step-by-step instructions in making the conversion please review: Using ODBC
- We are currently running ColdFusion Version 5

In terms of style and use, CFML is very similar to HTML. Like HTML, it is tag based and doesn't require learning a programming language with a unique syntax. However, the similarities to HTML end there: HTML is used to define the structure, layout and overall design of a web page. CFML is used to specify actions to take in the form of small server-based programs. As in most Web application environments, HTML and CFML are used in the same files that are processed by the ColdFusion server to generate complete Web pages to be displayed in the users' browsers.
As with ASP files, the CF server presents the code to a browser after stripping out the CFML tags. Here's an example of the original CFML file and then the source code that is "seen" by a browser:

.cfm file shows:

<cfquery datasource="database" password="db-password" username="db-username" name="products">

SELECT id, name, price
FROM products
ORDER BY id
</cfquery>

<html>
<head>
<title>Products List</title>
</head>
<body>
<table cellpadding=5>
<tr bgcolor="788C78">
<td>Item ID</td><td>Name</td><td>Price</td>
</tr>
<cfoutput query="products">
<TR bgcolor="CCCC99"><TD align="center">#id#</td><TD>#name#</td><TD>#price#</td></tr>
</cfoutput>
</table>
</body>
</html>

browser source shows:

<html>
<head>
<title>Products List</title>
</head>
<body>
<table cellpadding=5>
<tr bgcolor="788C78">
<td>Item ID</td><td>Name</td><td>Price</td>
</tr>
<TR bgcolor="CCCC99"><TD align="center">1</td><TD>Basic</td><TD>500</td></tr>
<TR bgcolor="CCCC99"><TD align="center">2</td><TD>Intermediate</td><TD>1000</td></tr>
<TR bgcolor="CCCC99"><TD align="center">3</td><TD>Advanced</td><TD>1500</td></tr>
<TR bgcolor="CCCC99"><TD align="center">4</td><TD>Expert</td><TD>2000</td></tr>
</table>
</body>
</html>

The actual web page shows the following table:

Cold Fusion is frequently used in conjunction with databases - to learn how to use CF with dbs in our linux environment please review: Cold Fusion & Databases