> So I created an application.cfm file and placed it in the
> same directory as all my other .cfm files. In it I did a
> bunch of named <CFQUERY>s to retrieve the legal values as
> part of application initialization.
>
> Then in my regular .cfm templates I refered to something like
> #Application.query_name.column_name# (where Application is
> literal). I got an error message when the referring template
> was launched telling me that it didn't know about my
> applications variable.
>
> My question is: Am I doing this right? Is this the way to
> define and then use application level variables? Is it true
> that these queries will be executed only once in the application
> or will they be executed whenever any template is launched
> (when the automatic inclusion of Application.cfm occurs)?
> Do I need some <CFIF> in the Application.cfm template to make
> sure they are executed only once? If so, what should the condition
> be? etc. etc. etc.
Without seeing your code, I can only make assumptions about what exactly
you're doing. Here goes.
1. You'll need a CFAPPLICATION tag in application.cfm to use Application or
Session variables. It might look like this:
<CFAPPLICATION NAME="myapp" SESSIONMANAGEMENT="TRUE">
2. You'll only want to execute the queries if they're not already stored as
application variables, so you'll need to wrap them in conditional logic to
check for their non-existence. You'll probably want to do all this within
application.cfm:
<CFIF NOT IsDefined("Application.MyQuery")>
<CFQUERY NAME="Application.MyQuery" ...>
...
</CFQUERY>
</CFIF>
3. You'll have to use "Application." or "Session." in your query name to
place it within the Application or Session scope.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.