In this article I'm going to cover one of the most fundamental things that is in every programming language. Variables, now don't get scared, in ColdFusion they're dead easy to use. Unlike Dynamic SQL statements in ASP, they won't make your brain hurt. For those of you who don't know what Variables are, they're exactly what they say they are. You use them to make your applications do things based on what gets sent into the application. In ColdFusion all variables are in cased in #
(Hash signs or pound signs depending on where you're from) hence #variablename#
will be replaced by whatever value is tied to that variable.
In ColdFusion there are many different variable types, perhaps more so than in other programming languages. Different variable types exist due to the places that they originate from and how they are created. The following list should explain what they're about.
VariableType | Description of Variable use |
Local | These variables are created with the CFSET or CFPARAM tag in a template. |
URL | These dead useful variables represent values append onto the end of a URL. e.g. <A href="http://www.go.com/file.cfm?name=John> example </A> |
CGI | This type will give you access to so called "environmental" variables, things like the server name, what browser the user is using and some HTTP header info. |
Cookie | Allows access to the values held inside cookies, 'nuf said. |
Query | Access variables from a particular query. |
Form | Get the values of information input and submitted via forms. |
Client | Variables associated with a particular user or client. |
Server | These are a part of the webserver, like server version etc. |
Session | These are really cool (or maybe I should get out more), they, in short, are linked to a browser session, e.g., the server tracks the user and stores variables connected to the browser. |
Application | These are tied to a particular application I'll cover these when I get to the ColdFusion Application Framework. |