I prefer to use Request scope if the variable does not need to persist
across requests.  Request scope can be accessed from any template, even
custom tags (which I believe was it's original purpose), and no locking is
required since it's not a shared scope.

I set several Request scope variables--including datasource names--in my
application.cfm files and then use them throughout the app.

Chris Lofback
Sr. Web Developer

TRX Integration
28051 US 19 N., Ste. C
Clearwater, FL  33761
www.trxi.com


-----Original Message-----
From: Alex Hubner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 25, 2002 4:30 PM
To: CF-Talk
Subject: What is the best variable scope?


Dear friends,

Sorry for this stupid question but I really didn't find a consensus on
that. What is the best variable scope to be used on applications (not
using Fusebox or any other methodology) that need to be present on every
template. Variables that we can use in the Application.cfm to set a
datasource name, page titles, etc. Application scope is not consider
because it requires the use of CFLOCK and I don't want to remember it
(and lock my code) everytime I need to output a datasource name, for
example.

I use the simple Local variables (by seting it using <CFSET var="value">
or <CFSCRIPT> when there are many of than) but I have seen people using
Request.variable instead. Wich is best in terms of speedy and safety?

Thanks!
Alex


______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to