Ok, I understand that part of the FuseBox ideal is to create code that is so
reusable that it can be used as a custom tag....
So, I'm trying to do this, but have run into a number of obstacles and would
appreciate advice on how you deal with this.
I understand:
app_globals is used as when a page is called as a custom tag (or cfmodule)
Application.cfm doesn't get run, so we use app_globals with out
cfapplication tag in it.
BUT if I'm in App1 (which includes a cfapplication tag) and I cfmodule to
App2, when processing returns to app1 - App1 will have lost all its
application vars. e.g:
<!--- In /App1/index.cfm --->
<CFINCLUDE TEMPLATE="app_globals.cfm">
<CFSET APPLICATION.MyVar = "Test Value">
<CFMODULE TEMPLATE "/App2/index.cfm">
<CFOUTPUT>#APPLICATION.MyVar#</CFOUTPUT>
<!--- Uh oh, the above line causes an error, because the app is looking for
the var in app2 and doesn't know it's back in App1! --->
So, my current workaround is to have an Applcaition.cfm (which only contains
a cfapplication tag) and an explicitly included app_globals that initialises
all the vars I want. The only problem I have with this is that I end up with
2 copies of APPLICATION scoped data in the RAM, and I have A LOT of this...
It can also be a real pain to remember to write scripts that clear the
cached data from all apps that are using it..
Has anyone else experienced this?? The only other solution I can think of is
re-cfincluding the app_globals after every use of cfmodule..
Ofcourse, I'm having the same problem with OnRequest end as well, so I'm
going to have to create a seperate file and explicitly call that (e.g
app_RequestEnd.cfm)...
Ben.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists