Understanding CFML elements
21
If you did not include the pound signs around the
DateFormat(Now(), "mm/ddyyy")
function,
ColdFusion would not evaluate the function and the previous example would display your source
code, as follows:
For more information about how to use pound signs with functions, see
Developing ColdFusion
MX Applications
.
Variables
Variables let you store data in memory on the server. Variables always have a name and a value.
You can assign a value to a variable, or you can instruct ColdFusion to assign variable values based
on data that it retrieves from a data source, such as a database table.
Naming variables
You must use the following rules for naming ColdFusion variables:
•
Names are case insensitive (uppercase, lowercase, or mixed case).
•
Names can contain only letters, numbers, and underscore characters.
•
Each name must begin with a letter.
•
Special characters (such as double quotation marks ("), reserved names (such as functions and
tags), and spaces are not allowed.
Ways to use variables
You can use a variable for the following purposes:
•
Store data collected from a form.
•
Store results of a calculation (such as the number of database records returned).
•
Use as input to a function.
Creating variables with the cfset tag
ColdFusion lets you create variables as you need them. You create the variable (name and value)
using the
cfset
tag. The syntax for this tag is:
<cfset variable_name = value>
Содержание COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION...
Страница 1: ...Getting Started Building ColdFusion MX Applications...
Страница 6: ...6 Contents...
Страница 10: ......
Страница 30: ...30 Chapter 2 CFML Basics...
Страница 36: ...36 Chapter 3 Database Fundamentals...
Страница 48: ......
Страница 76: ...76 Chapter 6 Lesson 2 Writing Your First ColdFusion Application...
Страница 134: ...134 Index...