<x-html><div>At 02:54 PM 4/7/2001 +0100, you wrote:</div>
<blockquote type=cite class=cite cite><div>&gt; -----Original
Message-----</div>
<div>&gt; From: BORKMAN Lee
[<a href="mailto:[EMAIL PROTECTED]" 
EUDORA=AUTOURL>mailto:[EMAIL PROTECTED]</a>]</div>
<div>&gt; </div>
<div>&lt;snip&gt;</div>
<div>&gt; Basically I don't like the idea of </div>
<div>&gt; tampering with</div>
<div>&gt; a monolithic app_globals or myGlobals, when all I want to do
</div>
<div>&gt; is tell the app</div>
<div>&gt; that THIS server's document root is xxx instead of yyy.</div>
<div>&lt;snip&gt;</div>
<br>
<br>
<div>I've written a custom tag called whatserveristhis.cfm, which is
customised</div>
<div>for each server, that sets request.thisserver to the name of the
machine</div>
<div>eg on the dev box it says:</div>
<div>&lt;cfset request.thisserver = &quot;dev&quot;&gt;</div>
<br>
<div>Then, in the file that sets server specific variables:</div>
<br>
<div>&lt;cf_whatserveristhis&gt;</div>
<br>
<div>&lt;CFSWITCH EXPRESSION=&quot;#request.thisserver#&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;CFCASE VALUE=&quot;live&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CFSET
request.server.webroot&nbsp;&nbsp; = 
&quot;e:\www\myapp\&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;/CFCASE&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;CFCASE VALUE=&quot;test&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CFSET
request.server.webroot&nbsp;&nbsp; = &quot;d:\cf\myapp\&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;/CFCASE&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;CFCASE VALUE=&quot;dev&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CFSET
request.server.webroot&nbsp;&nbsp; =
&quot;f:\www\myapp\cf\hr&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;/CFCASE&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;CFCASE VALUE=&quot;other&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--- do nought - the
vars should be set in whatserveristhis.cfm on</div>
<div>any 'other' servers ---&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;/CFCASE&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;CFDEFAULTCASE&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;blink&gt;&lt;h1&gt;warning warning - server not
configured&lt;/h1&gt;&lt;/blink&gt;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;CFABORT&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;/CFDEFAULTCASE&gt;</div>
<div>&lt;/CFSWITCH&gt;</div>
<br>
<div>I added the &lt;CFCASE VALUE=&quot;other&quot;&gt; to enable the
code to run an any machine,</div>
<div>and in this case i leave it up to the local whatserveristhis.cfm to
set all</div>
<div>the variables necessary for the app.</div>
<div>With hindsight it might be worth sending the name of the app as an
attribute</div>
<div>of cf_whatserveristhis, but as most projects are confined to the 3
main</div>
<div>servers its not a maasive issue.</div>
<div>This has made it a doddle to move code between boxes without having
to mess</div>
<div>about changing stuff, and if you're worried about the
performance</div>
<div>implications of the custom tag call and cfswitch then you can always
edit</div>
<div>the file once its gone live...</div>
<br>
<div>Bert</div>
<br>
<div>ps I put whatserveristhis.cfm is in its seperate
/customtags/serverspecific/</div>
<div>directory to minmise the risk of it being moved between
servers</div>
<div>accidentally.</div>
<br>
<div>pps and it _should_ be called WHICHserveristhis.cfm, but its too
late now</div>
<br>
<div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to