> Excellent idea.  We have a need for just such a solution - using
> the same graphic elements on the secure and non-secure sides
> of a site.  A mapping would eliminate the need for duplicate copies
> of the files.


This is what I use in all Application.cfm files. It allows you to create
dynamic settings for 3 servers; development (taken to be 127.0.01), staging
(usually has several web sites on it, so you access it via
http://staging/somefolder/) and the production server (accessed via
http://www.somesite.com/).

Based on the URL used to access the site, the file determines which settings
to use. Obviously, change Request.Mappings.Webserver and
Request.Mappings.ColdFusion to whatever you need for your site.


<CFSCRIPT>
// These values relate to CGI.SERVER_NAME and are used to determine which
box this application is running on.
Request.Servers = StructNew();
Request.Servers.Development = "127.0.0.1";
Request.Servers.Staging = "staging";
Request.Servers.Production = "www.somesite.com";

// Set up URL variables.
Request.URLs = StructNew();

// Set up the ColdFusion mapping.
Request.Mappings = StructNew();
Request.Mappings.ColdFusion = "/somesite/";

// Set up the database variables.
Request.Database = StructNew();
Request.Database.Offline = "no";

// Dynamically set request variables based on the server this application is
running on.
if (CGI.SERVER_NAME IS Request.Servers.Development) {
   Request.URLs.Application = "http://"; & Request.Servers.Development & "/";
   Request.Mappings.Webserver = "/";
   Request.Database.DSN = "somedsn";
} else if (CGI.SERVER_NAME IS Request.Servers.Staging) {
   Request.URLs.Application = "http://"; & Request.Servers.Staging & "/";
   Request.Mappings.Webserver = "/somesite/";
   Request.Database.DSN = "somedsn";
} else {
   Request.URLs.Application = "http://"; & Request.Servers.Production & "/";
   Request.Mappings.Webserver = "/";
   Request.Database.DSN = "somedsn";
}
</CFSCRIPT>



-- 
Aidan Whitehall <[EMAIL PROTECTED]>
Macromedia ColdFusion Developer
Fairbanks Environmental +44 (0)1695 51775

______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to