The term coldFusion syntax refers to a set of rules that determine how the ColdFusion application will be written by the programmer, and interpreted by the ColdFusion Server.
These rules are referred to as the ColdFusion Markup Language (CFML). CFML is, as the name would suggest, a markup language that programmers need to use when they create a ColdFusion application.
CFML consists of a number of tags. Similar to HTML, these usually consists of an opening tag and a closing tag, and are surrounded by greater than and less than symbols. Closing tags have a forward slash after the less than symbol. ColdFusion tags can also contain one or more attributes.
ColdFusion tags use the following format:
Most tags also accept attributes, and some actually require certain attributes. In this cases it goes like this:
And many accept multiple attributes:
Here's an example that uses an actual CFML tag - the
There's no rule that says that it must be spread across multiple lines. It can all go on the same line if you prefer:
And here it is with an attribute:
The last example loops through a query called
myQuery and outputs the
firstname variable for each row in the query result. I've used the HTML
ul element to create an unordered list, and the HTML
li element for each list item.
More about loops later in the tutorial.