> Because many of the pages use include files that also
> use that var. Using them like this makes the var change
> on the include file and allows me to use a standard var
> name.

One thing I haven't seen mentioned on this thread yet is the request
scope.  If you need a variable accessible to all templates, regardless
of how they're called or included, you can set request variables in
the onRequestStart() method and they will be accessible from all
templates just like application scope variables, but without the
memory overhead of hanging around once the request is finished.

> Think about this example: on most pages I use http://, on
> a few pages I need https://. If I use a var, all the occurances
> become https://, even on the includes when I override the
> local setting with the exception.

Generally I set all of my URL variables to begin with "//" without the
protocol portion.  You can pass that directly to the browser and it
will automatically assume the same protocol as the page that's already
loaded.  You can then prepend a protocol when needed.  In other
applications I just keep two application variables, one for standard
URL and one for secure URL and use whichever one is needed given the
link I need to output.

Altering application scope variables outside of the
Application.cfc/cfm feels messy to me (aside from incrementing
counters, perhaps) so I try to avoid it whenever possible.


-Justin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348847
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to