<!--- This is a view-only example to illustrate CFAPPLICATION --->
<HTML>
<HEAD>
<TITLE>CFAPPLICATION Example</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">

<H3>CFAPPLICATION Example</H3>

<P>CFAPPLICATION defines scoping for a Cold Fusion application
and enables or disables the storing of client and/or session
variables.  This tag is placed in a special file called
Application.cfm that is run before any other CF template in
a directory where the Application.cfm file appears. You can not 
browse a file named Application.cfm since it is only supposed
to accessed by other files that use variables defined within it.
<P>Here is a read-only listing of a typical Application.cfm file:

<!-- Begin Application -->
<!-----------------------------------------------------------
	MODULE:			Application.cfm
	PURPOSE:		Application.cfm file for our sample
	CREATED: 		today's date
	AUTHOR:			the author
	COPYRIGHT:		(c) 1999 the author for a company
	CHANGE HISTORY: 
----------------------------------------------------------->
<!-----------------------------------------------------------
Name the application "eturtle" and turn on Session Management.
----------------------------------------------------------->
<!-----------------------------------------------------------
<CFAPPLICATION name="eturtle" sessiontimeout="60" sessionmanagement="yes">
<!--- set datasource for this application --->
<CFSET dsn = "my_dsn">
<!--- set global error handling for this application --->
<CFERROR TYPE="REQUEST" TEMPLATE="request_err.cfm" MAILTO="webmaster@mysite.com">
<CFERROR TYPE="VALIDATION" TEMPLATE="val_err.cfm" MAILTO="webmaster@mysite.com">  

<!-----------------------------------------------------------
Set some global variables for this application to
be triggered on every template. The following lock names
the session with the sessionID variable. Note that you should 
always lock session and application variables when you initialize 
and update them. 
----------------------------------------------------------->
<CFLOCK Name="#session.sessionID#" timeout="30">
	<CFIF NOT IsDefined("session.current_location")>
		<CFSET session.current_location = 'Davis, Porter, Alewife'>
	</CFIF>	
</CFLOCK>

<!-----------------------------------------------------------
Set application variables. Always lock shared variables prior
to writing to them. Use the applicationName variable
to specify the lock name.
----------------------------------------------------------->

<CFLOCK Name="#application.applicationName#" timeout="30">
	<CFIF NOT IsDefined("application.MainPage")>
		<CFSET application.MainPage = "default.cfm">
	</CFIF>
	<CFIF NOT IsDefined("application.sm_location")>
		<CFSET application.sm_location = "dpa">
	</CFIF>
	<CFIF NOT IsDefined("application.current_page")>
		<CFSET application.current_page = "#cgi.path_info#?#cgi.query_string#">
	</CFIF>	
</CFLOCK>
----------------------------------------------------------->
<!-- End Application -->
</BODY>
</HTML>       
