One technique for this is to alias the CGI variables you use:
<cfset CGI_SERVERNAME = CGI.SERVER_NAME />
And when you're developing locally, you can set that value as something else
to mimic the host you want to simulate.
<cfif CGI_SERVERNAME is "localhost">
<!---// put host to simulate here //--->
<cfset CGI_SERVERNAME = "my.simulated.host.domain.com" />
</cfif>
Then, you would fetch host-specific settings, etc, based on the aliased
value.
<cfset _host = CGI_SERVERNAME />
<cfquery datasource="#ds#" name="getAccountID">
select iaccountid from #schema#sa_accounthosts
where vchhost = <cfqueryparam cfsqltype="cf_sql_varchar" value="#_host#" />
</cfquery>
...then fetch settings for the account.
This type of setup can be used to have multiple host aliases for a single
account. A good example of this would be host1.domain.com and
host2.domain.com, but wanting them to share account data.
<cfquery datasource="#ds#" name="getDefaultHost">
select vchhost from #schema#sa_accounthosts
where bDefault = <cfqueryparam cfsqltype="cf_sql_char" value="1" />
and iaccountid = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#getAccountID.iAccountID#" />
</cfquery>
<cfif getDefaultHost.RecordCount>
<cfset _host = getDefaultHost.vchhost />
</cfif>
FYI, we use this type of setup for over 50 domains (some with multiple
hosts) running on a single code root.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:342556
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm