> I know that, within a custom tag, I can set/update a > variables on the calling page using the "caller" scope. > However, is there a way to do the opposite? On the > calling page, I'd like to "reach in" to the custom tag > and pull out a variable that gets set. > > The reason why I'd like to do it this was is that it > seems that my custom tag would be a bit more "modular" > in that if the tag is called from another application > using a different variable name, I'm not dependant on > the variable name I've used in the custom tag.
No, to the best of my knowledge, the internal local scope of the custom tag isn't exposed to the calling page - after all, that would defeat the purpose of having a separate local scope, and anyway, the custom tag has finished executing (and its local scope no longer exists) by the time that you get back to the calling page in most cases. However, the problem that you're trying to solve can be approached another way, by simply passing to the custom tag the variable name that you want to create: <cf_foo return="myvar"> Then, within the custom tag, you can use the SetVariable function to create a variable in the calling page with the name "myvar": <cfset valuetoreturn = "42"> <cfset rs = SetVariable("Caller." & Attributes.return, valuetoreturn)> In addition, you can use this syntax instead of SetVariable: <cfset "Caller.#Attributes.return#" = valuetoreturn> While I prefer the SetVariable syntax for reasons I won't bother explaining now, either will work. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists