I do something similar, but in application.cfm.  That way I don't have to change a 
bunch of individual templates.  Instead of a CFIF, you could use a CFSWITCH to choose 
between dev, test and live servers so no code needs to be changed anywhere as you move 
from server to server.

<CFIF (NOT CompareNoCase(CGI.SERVER_NAME,"localhost"))>
   local settings go here
<CFELSE>
   live settings go here
</CFIF>

---------------------------------------
Matt Robertson    [EMAIL PROTECTED]
MSB Designs, Inc., www.mysecretbase.com
---------------------------------------


---------- Original Message ----------------------------------
from: [EMAIL PROTECTED] (Jacob)
Reply-To: [EMAIL PROTECTED]
date: Thu, 13 Dec 2001 13:43:05 -0800

Create a template and add it to all of the files needed.  All you need it 
one line.

datasource.cfm

<cfset datasource = "changethenameofthedatasourcehere">


Then for your queries:

<cfquery name="whatever" datasource="#datasource#">
select *
from table
</cfquery>

So the files would look like this:

<cfinclude template="/datasource.cfm">
<cfquery name="whatever" datasource="#datasource#">
select *
from table
</cfquery>

At 01:36 PM 12/13/2001 -0800, you wrote:
>Hi.
>
>Suppose I have a datasource datasource1 pointing to
>Database1 on a SQL Server called test.
>
>Can I have another datasource called datasource1
>pointing to Database1 on SQL Server called dev?
>
>The datasource1 currently works fine on
>http://localhost/
>
>I have created a virtual site called
>http://localhost/Dev
>
>So, is there a way to have the same datasource name to
>point to different servers depending on if I am under
>http://localhost/ or http://localhost/dev?
>
>That way, I thought, I don't have to keep changing the
>cf code when the code moves to Test server from Dev.
>
>Please let me know if you need more details.
>
>Thanks
>AB
>
>__________________________________________________
>Do You Yahoo!?
>Check out Yahoo! Shopping and Yahoo! Auctions for all of
>your unique holiday gifts! Buy at http://shopping.yahoo.com
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
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