The code I am working has survived several generations of developers and is a convoluted mess. I would love nothing more than to be able to properly scope the variables being used throughout the rest of the application. The original application developers (if you want to call them that) did not scope any variables and left that entirely to Cold Fusion to figure out. The volumes of bad code are staggering ... changing one item can cause a cascading series of errors.
I do not have the option of properly scoping their variables. But at the same time, I would like to be able to call cf tag based functions in cfscript without scoping issues ... or at least have enough knowledge to overcome them (facilitates the rewrite we will be doing). Is it a good practice to place methods in the request scope? My CF has become a bit rusty ... how would I do that? Is there a more appropriate location to store these types of functions? Thanks Kevin Bridges S. Isaac Dealey wrote: >Hi Kevin, > >It sounds like you're suffering from a ... well... scoping variables >with cfc's is a little different. I'm told that at one point in time >it was recommended that you could use cfinclude within a CFC method >and the include would share variables with the CFC, but that hasn't >been the case at least since the beta of the first version of MX. >Since then the variables scope in your CFC is separate from the >variables scope of your calling page and afaik there's not a >good/convenient way to bridge that gap. In an OO purist sense this is >a good thing, because it preserves encapsulation... I would imagine >the easiest workaround for you is going to be to use the request scope >instead of the variables scope for data used by your included files. >Another alternative would be to make your include function not a part >of your core CFC. If the function is instead simply injected into the >request scope as for instance request.include() then it won't have its >own variables scope to be confused with the variables scopes of the >calling template or the template being included. > >hth > >s. isaac dealey 954.522.6080 >new epoch : isn't it time for a change? > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207168 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

