>> I have a custom tag that wants to use application
>> variables
>> (for performance). Since you need to run a cfapplication
>> tag
>> to use the application scope, it needs to somehow check
>> if
>> that tag has run. I have no clue how to do this. Is it
>> possible?

> I would think that you should be able to do this:

> <cfif IsDefined("Application")>
>  ... the application scope exists! Woohoo! ...
> </cfif>

You can do this -- although on CF5 you may not want to for reasons I won't get into in 
depth.

I've never run into a situation where I wasn't sure if the <cfapplication> tag had 
been executed, so I guess the context eludes me. I tend to also create a request 
structure with variables for all my <cfapplication> settings, such as 
sessionmanagement, sessiontimeout, clientstorage, setclientcookies, etc. and then use 
those request variables in the <cfapplication> tag, which allows me to also use those 
request variables to determine how my cfapplication is configured, for instance, I can 
determine the duration of sessions by checking request.myapp.timeout_session or 
determine if session variables are enabled by checking request.myapp.sessionmanagement 
... On CF5 and prior this is helpful for getting at this information without continual 
locking.

It can also be used to manage movement between disparate applications since you can 
run the <cfapplication> tag more than once on a page -- if you use a different name 
for the application the 2nd time, then content after the 2nd cfapplication tag will 
see all the application and session variables from the 2nd application and none from 
the 1st. But if you have the data already stored in a request structure, you can then 
duplicate it into a temp variable, drop into the 2nd application and then return to 
the original application. Think of it as a cf-application management application. :) 
In the wider IT world it's called Software Configuration Management (SCM). Of course, 
if you name the request variables distinctly, i.e. request.app1, request.app2 or 
request.apps.primary and request.apps.secondary then you can have access to all of the 
data for all the apps at all times and just pick and choose between different apps by 
including their <cfapplication> tags (store them in modules that can be included using 
cfinclude).

Anyway -- I've gotten way off the original subject. :)

>> Also, just to make sure - custom tags do have
>> normal access to the application scope, correct?

> Yes, although in general, when you write code modules,
> you may want to limit
> access to and from the modules to defined inputs and
> outputs.

Generally speaking imho it's best for custom tags to be "black boxes" if possible, in 
other words, feed it everything it needs as an attribute, and know what it returns (if 
anything). That way other templates never have to know anything about how the custom 
tag functions, all they have to know is what to pass to the tag and what to expect in 
response. Imho if you plan to use the custom tags directory, don't use the application 
scope directly -- feed those variables to it as attributes. Otherwise call the tags 
using relative paths (which is what I do anyway, and imho is better since it's more 
controlled), or a cf server mapping (which I avoid for the reason that they're 
difficult to get if you have shared hosting). 

s. isaac dealey                972-490-6624

new epoch                      http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

tapestry api is opensource     http://www.turnkey.to/tapi

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to