Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application Data

Status
Not open for further replies.

varnix

Programmer
Jan 7, 2002
94
US
Is there a way to pass data between users on a CF site?

I know that I can use the session variable to pass data throughout the user's actual session, but is there an application variable that works similar to the session variable?

Thanks!
 
You hit the nail on the head with your question. There is an Application scope in the same way there is a session scope.

If you declare a variable (using locking and all that around the variable) and assign it to the application scope, then that variable will be available to all users of that application. Remember to put a CFapplication somewhere in your site (application.cfm is best)

<CFLOCK scope=&quot;application&quot; timeout=&quot;10&quot; type=&quot;exclusive&quot;>
<cfset Application.ASDF = &quot;Testing&quot;>
</CFLOCK>

This will assign a variable called ASDF to the application scope with a value of Testing.

To access this variable in any other page use

<CFLOCK scope=&quot;application&quot; timeout=&quot;10&quot; type=&quot;Readonly&quot;>
<cfset variables.LocalASDF = Application.ASDF>
</CFLOCK>

<cfoutput>
#variables.LocalASDF#
</cfoutput>

Hope this helps!

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top