I wrote something similar, but didn't like the idea of reading the registry
with everypage request, so i came up with a dynamic whatserveristhis.cfm:
<cfset
regroot="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\Co
mputerName">
<cfregistry action="GETALL"
branch="#regroot#"
name="RegQuery"
type="String">
<cfset request.thisserver = RegQuery.value>
<cffile action="READ" file="#GetCurrentTemplatePath()#" variable="myvar">
<cfset output = "<cfsilent>"
& chr(60) & "!--- "
& chr(10)
& myvar
& chr(10)
& " ---" & chr(62)
& chr(10)
& "</cfsilent><cfset request.thisserver = """
& request.thisserver & """>">
<cffile action="Write"
file="#GetCurrentTemplatePath()#"
output="#output#"
addnewline="No">
What is does is read the registry and set the request.thisserver = machine
name.
And now the cunning bit - it uses CFFILE read and write to replace itself
with the <cfset> hardcoded, and the rest commented out...try it and you'll
see what i mean.
Bert
> -----Original Message-----
> From: Kevin Bridges [mailto:[EMAIL PROTECTED]]
> Sent: 15 May 2001 15:08
> To: Fusebox
> Subject: RE: relative directory paths
>
>
> It's a user defined variable ... I use the following in app_model:
>
> <cfregistry action="Get"
>
> branch="HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Comput
> erName\ActiveC
> omputerName"
> entry="ComputerName" type="String"
> variable="request.site.profile">
> <cfif not IsDefined("request.site.profile")>
> <cfregistry action="Get"
>
> branch="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Co
> mputerName\Com
> puterName"
> entry="ComputerName" type="String"
> variable="request.site.profile">
> </cfif>
> <cfset
> request.site.profile=Replace(request.site.profile," ","")>
> <cfinclude template="app_model-#request.site.profile#.cfm">
>
> Which then pulls a specific app_model-MACHINENAME.cfm (2
> registry tags one
> for w98 one for w2000)that is specific for the machine it is
> running on so
> that I'm not constantly changing variables when I switch
> machines ... it
> contains the following:
>
> request.Site.CFRoot="#cgi.PATH_TRANSLATED#";
> request.Site.HostName="#cgi.SERVER_NAME#";
> request.Site.WebRoot="/Web/";
> request.Site.MachineRoot="C:\Web\";
> request.Site.DSN = "MyDSN";
> request.Site.imagesroot="#request.Site.WebRoot#_img/";
> request.Site.title="Site Title";
> request.Site.dbtype="Oracle80";
> request.Site.ApplicationTimeout="20";
> request.Site.MailServer="mail.server";
>
> Then for each module I use an app_locals that contains:
>
> // Site Specific Variables
> request.Module.CFRoot="#cgi.PATH_TRANSLATED#";
> request.Module.WebRoot="#request.site.WebRoot#ModuleName/";
> request.Module.MachineRoot="#request.Site.MachineRoot#ModuleName\";
> request.Module.DSN = "#request.site.dsn#";
> request.Module.dbtype="#request.site.dbtype#";
> request.Module.imagesroot="#request.site.imagesroot#";
> request.Module.title="My Module";
> request.Site.ApplicationTimeout="#request.Site.ApplicationTimeout#";
> request.Site.MailServer="#request.Site.MailServer#";
>
> That way I can break the modules off and use them as
> standalone applications
> or plug them into a larger system at will. I can also change specific
> varaibles for the modules if I ever need to.
>
> -----Original Message-----
> From: McCollough, Alan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 07, 2001 9:52 AM
> To: Fusebox
> Subject: RE: relative directory paths
>
>
> I gotta ask, cuz' I don't know and its early Monday...
> This request.cfroot, is it an internal variable used by CF, or is it a
> user-defined variable that y'all are using to tack down the
> root dir for a
> give app?
>
> > -----Original Message-----
> > From: Tim Price [SMTP:[EMAIL PROTECTED]]
> > Sent: Friday, May 04, 2001 6:55 AM
> > To: Fusebox
> > Subject: RE: relative directory paths
> >
> > Tim (great name by the way !)
> >
> > I already have my request.cfroot variable set to <cfset
> request.cfroot =
> > "/somedir">
> >
> > thanx anyway
> >
> > Tim
> > {redacted}
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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