Like HTML, ColdFusion is a tag based language. If you have ever wanted to gain a working knowledge of ColdFusion, you will find this article to be a good place to start. It covers starting and stopping the MX 7 server, configuring a virtual directory, and testing the directory.
My First Application on ColdFusion MX Server - ColdFusion Tags CFSET and CFOUTPUT (Page 6 of 6 )
These two tags are used to manipulate variables, and in the next tutorial we shall look at a number of other useful tags in writing content, in creating data based applications, and so on.
The CFSET tag is used to assign a variable, in the above case, a string variable strg with a value Welcome to ColdFusion MX 6.1. We will have occasion to look at these more closely later on. For now it is sufficient to know that the variable strg has been assigned a value.
The CFOUTPUT tag allows displaying of the variable in the browser when the HTML page is rendered. The variable strg must be enclosed between #...# for strg to be interpreted as a variable, otherwise, it will be interpreted as a literal string and returned as such. It is important to get used to the syntax. The tags almost always come in pairs, an opening tag with or without the attributes and a closing tag. The tags are not case sensitive as in XML (see last picture), although there are rules as to what characters can be used for variables and other things. We shall look at these in the next and later tutorials.
Browsing the CFM file
If the URL http://localhost/TestingCF is typed in the address field of a browser, we should see the output of the CFM as well as the HTML rendered, as seen in the next picture.
One should not be left with the impression that CFM should always be embedded in an HTML file. The next file, Test.cfm, is also correct, as shown below:
<cfsEt strg="<b>Welcome to ColdFusion MX 6.1</b>">
You might have noticed that the "Welcome to ColdFusion MX6.1" is in bold. This is to say that after processing the "CF" tags the result is returned in HTML. Also notice that the tags are not case sensitive, <cfoutput> is same as <CfoUtPut>.
The ground work for creating CFM files and publishing them to an IIS server has been accomplished. Files are copied to, or uploaded to the MyCFusion directory, and they are accessed by the URL of the virtual directory, http://localhost/TestingCF. The files may also be browsed by directly going to the IIS. Two of the important tags were discussed as well, namely CFSET and CFOUTPUT. It must be remembered that, if the server is not running, accessing the file on the server would produce a Server not Found, or DNS error. Either you may set the server to start automatically, or remember to start the server before it can serve the pages.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.