Introducing ColdFusion
page 4 of 5
by Debjani Mallick
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 20383/ 40

Basics of CFML

Being a dynamic application development tool, CFML includes the feature of a programming language like variables, constants, functions, loops (flow-control tags), etc. CFML also includes CFScript which allows us to use syntax similar to JavaScript for many of the operations. The built-in tags included cover a large range of functionalities like creating forms, manipulating variables, processing ColdFusion pages, accessing database, handling errors, manipulating files and directories, using protocols, etc. One can also create his own custom tags which can encapsulate frequently used code at one place. If custom tags are written using CFML, then they can take the advantage of all the built-in tags and even other custom tags of ColdFusion. CFX tags are custom tags written in a programming language like Java or C++. Generally, CFX tags are executed faster than CFML custom tags since they are compiled. Similarly, for functions, the built-in functions in ColdFusion can perform a large range of functionalities including creating queries and manipulating them, evaluating the values of dynamic data, performing mathematical operations, etc. One can also create user-defined functions using ColdFusion. ColdFusion components are basically a group of related user-defined functions and variables. They also have the capability of providing and controlling the access to the component's content. ColdFusion components can provide web services and also make them available on the Internet. They can also provide ColdFusion services that Flash clients can call directly.

Now, coming down to variables and constants, constants are simple scalar values whose value does not change during program execution. Variables' value can be set and reset. The two main characteristic of a variable is its scope and its data type. Some examples for the scope of a variable are the following.

·         Variables scope (local) – It is the default scope whenever we declare a variable using the cfset and cfparam tags. Such types of variables are only available on the page on which they are declared.

·         Form – These variables are the form variables which are sent to the form’s action page on submission of the form.

·         URL – The parameters passed in the URL to call the current page.

·         Request – These variables are available to all pages. These are used to hold the information that is required for the duration of a HTTP request.

·         CGI – These variables are environment variables identifying the context in which the page was requested.

·         Cookie – These are the variables present in the user’s browsers as cookies.

·         Client – These variables are associated with one client.

·         Session – These variables are associated with one session. These are available for the time for which the client maintains a session.

·         Application - These variables are associated with one application on the server.

·         Server - These variables are associated with one ColdFusion server.

·         Arguments – These are the variables passed which call a user-defined function.

Similarly, for the data type of a variable, it can be:

·         Simple, representing one value. For example, strings, integers, Boolean values, etc.

·         Complex, like arrays, structures, etc.

·         Binary, representing raw data like the content of a GIF file.

·         Object, like Java, web services, ColdFusion components objects, etc.

ColdFusion includes a lot of flow control tags like cfif, cfelse, cfelseif, cfswitch, cfcase, cfdefaultcase, cfloop, cfbreak, efexit, etc. cfif, cfelse and cfelse provide the functionality of if-then-else conditional processing. If a condition is true, then execute a block of code and if not, then execute the block of code in cfelse part. If multiple conditions are given, check for each condition and whichever condition satisfies, execute the block of code for that condition. Similarly, cfswitch, cfcase and cfdefaultcase allow for selecting from a set of different codes depending on the value of an expression. The cfloop tag allows looping over a block of code for a desired number of times. cfbreak tag is used to exit the cfloop.

CFScript tag in ColdFusion is used to write code in programming language similar to Java, but is simpler than Java. It provides an efficient way to write ColdFusion logic.


View Entire Article

User Comments

Title: mr   
Name: todd
Date: 2008-03-01 10:42:07 AM
Comment:
"I am sure after reading this article you have developed a basic idea on ColdFusion."

But not why I'd want to use it....

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-04-13 1:06:35 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search