Programming instructions
Understanding CFML elements 17
Most often the end tag encloses the tag name in brackets and includes a slash (/), like
this:
</tagname>
The information processed by ColdFusion is placed between the start and end tag, like
this:
<tagname>
info to be processed ...
</tagname>
ColdFusion tags, for the most part, share these common characteristics:
• All start with cf.
• A start and end tag.
• Use of attributes (like html tags), and most attributes have values.
Some ColdFusion tags, such as
cfset, omit the closing tag. This type of tag uses one set
of angle brackets and places all the required information between the left (<) and right (>)
angle brackets, like this:
<cfset name="bob">
For a complete list of tags and their syntax, see CFML Reference.
Tag attributes
Tag attributes instruct the ColdFusion server about the details of an operation. For
example, to update a database table, the server needs to know specifics about the
database, such as the database name and the table name. The code required to write this
type of statement might look like this:
<cfupdate datasource="mydb" tablename="mytable">
where datasource and tablename are attributes of the cfupdate tag and "mydb" and
"mytable" are attribute values.
For a complete list of tags and their attributes, see CFML Reference.
Functions
Typically, a function acts on data. It can generate a value or a set of values, usually from
some input. You can perform the following operations (actions) with functions:
• Manipulate data and time values
• Examine a value or variable
• Display and format information
• Manipulate string data
• Retrieve system information and resources
• Perform mathematical operations
Using functions on values
Usually, a function performs an operation on a value, and the value can include the value
of a variable. For example: to format the value of a variable containing a value in dollars,
the code to write this statement might look like this:
#DollarFormat(price)#