[thelist] ColdFusion Application Variables

Jay Dorsey evolt at jaydorsey.com
Thu Feb 6 09:20:01 CST 2003


I'm using CF 5 on nix and Windows machines, so in order to make the code
more portable I've been putting the following type of "stuff" in the
Application.cfm file:

site = structnew();
site.url = "myurl.com";
site.inc = structnew();
site.inc.docroot = "/path/to/docroot/";

I do this so that I can easily change the path variables and what not in
one place should I need to port/move the code to a different machine.

On the pages I create, I would have something like
#site.inc.images#myimage.jpg (for example) instead of a hard coded path
to the images.

Recently, in another project, I've taken to using Application variables
to store this information (using a lock and paraming the variables).

I'm wondering if there is a performance increase by using Applicaiton
variables versus creating a structure for each page to hold the
variables.  Is there an even better way to do it?  These variables are
the same across the whole site/application and won't be changed often
(if it all).  It seems to me that it would be more work for CF to
recreate the structure on each page than it would be to hold the
Application variable and call it each time.

I know we have a few CF experts here, any insight/tips would be highly
appreciated.

Thanks,

jay






More information about the thelist mailing list