(ColdFusion Tutorial – Part 2) Next >
NOTIFICATION: These notes are published for educational purposes. Using these notes is under your own responsibility and risk. These notes are given ‘as is’. I do not take responsibilities for how you use them.
ColdFusion is a programming environment which allow for the creation of server-side web applications, very similar to technologies such as ASP and PHP. ColdFusion allows the integration of many technologies such as web services, Java, XML, and more.
ColdFusion works on top of many web servers such as Apache and Microsoft Internet Information Services (IIS). Here is the link which display the different requirements for the installation of ColdFusion in your computer: http://www.adobe.com/products/coldfusion-standard/tech-specs.html
ColdFusion use ColdFusion Markup Language scripting language which made appearance in 1995. The designed was Jeremy Allaire and was developed by Adobe System, Railo, and New Atlanta. ColdFusion Markup Language works also for BlueDragon and Railo. This scripting language follows the guidance of the CFML Advisory Committee formed by Adobe in June 18 of 2009.
A ColdFusion application written by the programmer must follow a set of rules called syntax. This syntax is then interpreted by ColdFusion Server. In this case, this syntax is called ColdFusion Markup Language (CFML). ColdFusion Markup Language (CFML) allows the production of web applications by providing a scripting language similar to HTML and XML allowing for conditional operators, queries to databases, read and write files operations, loops, bulk emails, high-level formatting functions, database administration throw commands and other elements. By using CFML tags (tags which are only recognized by ColdFusion server), we can obtain a web application that runs in any browser like any regular website would do.
The way this syntax works is by using several tags. These tags normally go in pair, an opening tag and a closing tag; however, there are cases in which is one tag without a closing tag. CFML tags can also contain attributes. Here is an example:
<tagname attribute = “value”> <anothertagname attribute='value'> Code/text that is affected by the surrounding tags. </anothertagname>
Let’s see example using actual CFML syntax:
<cfset firstVariable = 123> <cfset secondVariable = 321> <cfset sumVariables = firstVariable + secondVariables> First variable: <cfoutput>#firstVariable#</cfoutput> <br/> Second Variable: <cfoutput>#secondVariable#</cfoutput> <br/> Sum of both varaibles: <cfoutput>#sumVariables#</cfoutput> <br/>
Let’s analyze the previous scripting code:
<cfset firstVariable = 123> <cfset secondVariable = 321>
The tag cfset allows the creation of a variable and also the assignment of a value to this variable. In this case we are creating two variables, firstVariable and secondVariable), and we are assigning values to both of them (firstVariable with 123 and secondVariable with 321).
The third tag is also a cfset as previous tags; however, in this tag we are creating a new variable, sumVariables, and assigning a value which is a mathematical operation:
<cfset sumVariables = firstVariable + secondVariables>
The cfoutput tag allows us to display an output which contains the results of processing ColdFusion variables and functions:
First variable: <cfoutput>#firstVariable#</cfoutput> <br/> Second Variable: <cfoutput>#secondVariable#</cfoutput> <br/> Sum of both variables: <cfoutput>#sumVariables#</cfoutput> <br/>
Here the output would be:
First variable: 123 Second variable: 321 Sum of both variables: 444
Notice that we have another tag: <br/>
This tag is a regular HTML tag. As you can see we can mix HTML and CFML tags without any issues since later on the output will be anything except CFML tags and code related with them.
(ColdFusion Tutorial – Part 2) Next >