14
Developing Web Applications with ColdFusion
Adding More Variables to the Application
Applications can use many different variables. For example, the
calldept.cfm
application page can set and display values for department, city, and salary.
To modify the application:
1.
Return to the file
calldept.cfm
in ColdFusion Studio,
2.
Modify the code so that it appears as follows:
<HTML>
<HEAD>
<TITLE>Call Department</TITLE>
</HEAD>
<BODY>
<STRONG>Call Department</STRONG>
4
<!--- Set all variables --->
<CFSET Department="Sales">
4
<CFSET City="Boston">
4
<CFSET Salary="110000"
4
<!--- Display results --->
<CFOUTPUT>
4
I’d like to talk to someone in #Department# in #city# who earns at
least #Salary#.
</CFOUTPUT>
</BODY>
</HTML>
3.
Save the file.
4.
View the page in your Web browser by entering the following URL:
http://127.0.0.1/myapps/calldept.cfm
Development Considerations
The same development rules that apply for any programming environment apply to
ColdFusion. You should also follow the same programming conventions that you
would with any other language:
•
Comment your code as you go.
HTML comments use this syntax:
<!-- html comment -->
CFML comments add an extra dash:
<!--- cfml comment --->
•
File names should be all one word, begin with a letter and can contain only
letters, numbers and the underscore.
•
File names should not contain special characters.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...