howdy all - 

I've got a question about scoping with the 'request' scope. But I suppose it 
can be applied to conversion of any scope.

In the app I have a series of var's that will need to be used in templates, 
CFC's (user defined and Application.cfc)and custom tags. The var's are all in 
the 'request' scope. 

What I'm having issue with is that when they get passed to the next template 
from a URL or a FORM, they are then placed in those scopes. So I'm wondering if 
the best practice is to have a code block that runs in the Application.cfc 
(onRequest) that does the following?

<cfif isDefined(form.variable_name)>
   <cfset request.variable_name = form.variable_name>
</cfif>
<cfif isDefined(url.variable_name)>
   <cfset request.variable_name = url.variable_name>
</cfif>

And do this for each variable? It seems a little tedious. And that leads me to 
wonder if I'm even approaching it correctly.



Extra background to how I got here:

Outline:
I'm using a very loose version of FuseBox (basically just the file structure 
and fuseactions)
 
App Folder Structure:
|---Intranet Base Folder - (Application.cfc sets up the application.dsn, 
session.ID's user and other top level info)
     |--- Document Management folder - (Application.cfc (extends the above 
Application.cfc), runs a folder security check using a request.var)
 
My observations:
1) When I include the app_Globals.cfm file (holds all my cfparam-var's) into 
the second Application.cfc, the var's can be used in that CFC but not the 
index.cfm that is the page being run.
2) Obviously if I include the app_Globals.cfm file into the index.cfm file then 
it works fine, but the call to one of the var's in the second Application.cfc 
file fails. (expected)
3) I could include the app_Globals.cfm into both pages (application.cfc and 
index.cfm), but this seems wrong..
 
My proposed solution:
Scope all of the var's in the app_Globals.cfm as 'request.varName' variables, 
and include into the second Application.cfc file.

Thanks for everone's time,

Brent Nicholas

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262439
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to