Do you use the fusebox methodology?
-----Original Message-----
From: Benjamin Fitts [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 05, 2000 10:01 AM
To: CF-Talk
Subject: RE: Application.cfm
Regarding Application variables.
When my code wasn't properly written I thought custom tags couldn't read
application variables but I figured out I was doing something wrong.
Custom tags can read application variables; just scope the variable as
application.variablename. You need to scope the variable BOTH in the
application.cfm and the custom tag.
In your application
<cfset application.variablename = "variable">
In your custom tag
#application.variablename#
Scoping it as request.variablename is BAD! The request scope is set for each
PAGE request and is not the same thing as application scope. Before I
figured out my application scoping problem I set everything to request scope
only to have to go back and change it later. This is a big performance
issue if you run a big site.
If your variables aren't available to your custom_tag I think you have
another problem with your code that should be examined.
Also remember to always try and scope your variables. Local variables are
variables.scope application are application.scope session variables are
session.scope etc.
Benjamin Fitts
Web Developer
uClick
[EMAIL PROTECTED]
-----Original Message-----
From: Jason Egan [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 04, 2000 3:19 PM
To: CF-Talk
Subject: RE: Application.cfm
No, I don't believe so - custom tags - called by cf_ or cfmodule are run on
a separate thread, so they aren't aware of application variables (like #dsn#
for your datasource).
The datasource is usually what I ran into trouble with, so I passed it as an
attribute:
<cfmodule template="test.cfm" userid="10" dsn="#dsn#">
Then attributes.userid and attributes.dsn would be available to me in my tag
test.cfm.
hope this helps.
je
-----Original Message-----
From: Neil H. [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 04, 2000 11:19 AM
To: CF-Talk
Subject: Application.cfm
Would application variables be available to a module (i.e. a template called
by CFModule) ? And if they are how far up the tree will CF look for the
application.cfm file?
My problem is I set a variable called datasource equal to my DSN name. I
attempt to reference #datasource# and even #application.datasource# in my
module and it isn't available.
Any help or suggestions would be appreciated.
Neil
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists