Introduction to ColdFusion Markup Language
(Page 1 of 7 )
If you want to get a good start on learning ColdFusion, look no further. This article covers a whole bunch of CFML tags and some basic functions. It is the first of two parts, and excerpted from chapter three of the book
ColdFusion Web Development with Dreamweaver MX 2004, written by Jen and Peter deHaan et al. (Apress; ISBN: 1590592379).
COLDFUSION MARKUP LANGUAGE (CFML) is ColdFusions own set of tags that makes up the bulk of the dynamic functionality found on ColdFusion pages. CFML has two different parts that make ColdFusion work: tags and functions. In this chapter we cover a whole bunch of CFML tags and also some basic functions. Chapter 4 shows you how to use some of the more advanced functions and teaches you about variable scopes and different data types.
Tags are used to carry out operations, such as looping over Recordsets, uploading files to a web server by way of a web form, dumping the contents of a variable to the screen for debugging, and grabbing the contents of a remote page on the Web. Functions within ColdFusion are used to manipulate data or perform calculations. For example, ColdFusion has a function called #ArrayAvg()#, which calculates the average of the numeric values within an array. You often must use tags and functions together to build a completely functional site.
Introducing CFML
HTML and ColdFusion tags can exist together within a document that is requested from a web server. All ColdFusion tags start with <cf. The ColdFusion server will process anything within these tags, ignoring any plain HTML tags. The server will return any HTML generated by processing your ColdFusion tags, and then the entire page is returned to the user's browser. Other things to note about CFML include:
- Whenever using ColdFusion tags within a document, you must save it as a.cfmfile for it to be recognized and interpreted by the ColdFusion server.
- In text strings, all text is considered literal unless it is within a set of pound/hash (#) signs.
- ColdFusion elements (the opening and closing tags, and everything in between) are called blocks. For example, if you were using a<cfif>element in your code, it would be called the<cfif>block.
- To add comments inside ColdFusion tags, you must use CFML comment delimiters:<!--- CFML comment --->. Notice that these are similar to HTML comments, but have three dashes instead of two. If you use HTML comments inside your CFML, they will not be ignored by the ColdFusion server as expected, and you will either get errors or will dynamically create HTML comments. Also, CFML comments will not send text back to the users browser like HTML comments do.
Now we provide a general overview of the many categories of tags, and the most common ones you will be likely to use in your work. We then go through some of these tags in detail, along with the functions that help these tags work and make your applications run.
TIP You can also extend ColdFusion by writing your own custom tags using CFML, or even Java or C++. Writing custom tags is covered in more detail in Chapter 10. Custom tags written in ColdFusion are prepended with CF_, whereas any custom tags written in Java or C++ are prepended by CFX_. |
Next: Tags Used in CFML >>
More ColdFusion Articles
More By Apress Publishing
|
This article is excerpted from chapter three of the book ColdFusion Web Development with Dreamweaver MX 2004, written by Jen and Peter deHaan et al. (Apress; ISBN: 1590592379). Check it out today at your favorite bookstore. Buy this book now.
|
|