• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
Kinds of ColdFusion Variables:
Kind of Variable Description
Queries As soon as a query has been run, you can use its results asdynamic parameters. For example, if you create a querynamed LookupUser that finds the ID for a given user name,you can use this ID in another query or in a call toCFOUTPUT.Reference: queryName.variableNameLocal Variables This is the default scope for variables created with the CFSETand CFPARAM tags. For example, <CFSET A=5> sets thevariable A to 5. This variable is available only on the pagewhere it is created and any included pages.Reference: vLocalVariableURL Parameters Parameters appended to URLs after the application page nameusing a variablename=value format. URL parameters arestored in structures. See Variables stored in structures for more details.Reference: url.variableNameForm Fields The most common way of passing parameters to a page is touse form fields. When a user enters data in a form field, a parameter with the name of the form field is passed to theaction page. Form fields are stored in structures. SeeVariables stored in structures for more information.Reference: Form.variableNameClient ColdFusion client variables are variables associated with a particular client. Client variables allow you to maintain stateas a user moves from page to page in an application. They arestored in the system registry by default, but you can alsochoose to store them in a cookie or in a database. Clientvariables are part of the ColdFusion Web ApplicationFramework. For more information about client variables inthis context, see Developing Web Applications withColdFusion.Reference: client.variableNameServer ColdFusion server variables are associated with the currentWeb server and are available to all ColdFusion applicationsuntil the ColdFusion server is shut down. This server scopeallows you to define variables that all your ColdFusionapplication pages can reference. Server variables are stored instructures. See Variables stored in structures for moreinformation. For information on locking server variables, seethe description of CFLOCK in CFML Language Reference.Reference: server.variableNameSession Session variables are tied to an individual client and persistfor as long as that Client ID maintains a session. Sessionvariables, like current client variables, require a client name to
 
work and are only available to that Client ID. Unlike clientvariables, session variables are stored in the server's memoryand can be set to time-out after a precise period of inactivity.Session variables are stored in structures. See Variables storedin structures for more details. Session variables should belocked when accessed. For information on locking sessionvariables, see the description of CFLOCK. Session variablesare part of the ColdFusion Web Application Framework. Thismeans that they are used in the context of an Application.cfm page. For more information about session variables in thiscontext, see Developing Web Applications with ColdFusionand the description of the CFAPPLICATION tag.Reference: session.variableNameApplication Application variables are tied to an individual application asdefined in the CFAPPLICATION NAME attribute, typicallyused in the Application.cfm file. Application variables onlywork if an application name has been defined. Applicationvariables are stored in structures. See Variables stored instructures for more information. Application variables should be locked when accessed. For information on locking sessionvariables, see the description of CFLOCK in CFML LanguageReference. Application variables are part of the ColdFusionWeb Application Framework. This means that they are usedin the context of an Application.cfm page. For moreinformation about session variables in this context,Developing Web Applications with ColdFusion and thedescription of the CFAPPLICATION tag.Reference: application.variableNameRequest Request variables store data that pertains to the processing of a single page request. They are a convenient way to store datain a structure, carried through nested tags, such as CustomTags, and processed at once. Request variables are stored instructures. See Variables stored in structures for moreinformation.Reference: request.variableNameCaller Caller variables let you call and use variables from the callingtemplate in a ColdFusion custom tag.Reference:HTTP Cookies HTTP Cookie variables are stored in the browser. They areavailable every time the browser makes a page request. Youcan create cookie variables with the CFCOOKIE tag.Reference: cookie.variableNameFile File variables are read-only. These variables are created whena CFFILE ACTION=UPLOAD operation is executed.Reference: cffile.variableNameCGI Environment Every page request has several environment variables sent to
 
it that relate to the context in which it was requested. Thevariables available will depend on the browser and server software in use for a given request. Note: CGI environmentvariables are created even when you are using one of the Webservers that supports a server API.Reference: cgi.variableName
Order of ColdFusion variable look-ups
When scoping is not used, that is, when you don't include a variable prefix, such as"Form.myformvar," ColdFusion attempts to find variables in the following order:1.Local variables created using CFSET and CFQUERY2.CGI variables3.File variables4.URL variables5.Form variables6.Cookie variables7.Client variables
Note
ColdFusion does not attempt to automatically find Application, Session, Server, andRequest variables, nor does it try to find CFML tag variables, with the exception of Filevariables. You must use prefixes with these variables..
Variables across application pages
Within ColdFusion, most variables apply only to a single template. However, severaltypes of variables can be used across multiple application pages:
 
Client variables store identifying information about an individual client.Client variables are designed to hold long-term information particular to an individualclient. You can store client variables in the system registry, a database, or in a cookienamed for the application.
 
Server variables are valid for all ColdFusion applications on a particular server.
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...