the cgi.http_host can be different for the same machine....
eg http://209.165.154.6/ and http://www.anmc.org/
Bert
ps i enhanced the one below to check for a URL parameter, which if defined,
would cause the file to revert back to the original, but i can't find it now
- i think it overwrote itself...
> -----Original Message-----
> From: McCollough, Alan [mailto:[EMAIL PROTECTED]]
> Sent: 15 May 2001 17:10
> To: Fusebox
> Subject: RE: relative directory paths
>
>
> This is cool!
> I love how the code rewrote itself.
> BuTtTtTt, how does this differ from simply quering the value of
> CGI.HTTP_HOST ?
>
> > -----Original Message-----
> > From: Kevin Bridges [SMTP:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 15, 2001 6:50 AM
> > To: Fusebox
> > Subject: RE: relative directory paths
> >
> > Pretty slick. So if a group were working with some type of
> source control
> > this would be the file checked into source control ... each
> time a new
> > installation is done on either a developers machine, test server, or
> > production server they get latest and this code runs the
> first time the
> > application is hit turning the cfset request.thisserver
> into a hardcoded
> > variable specific to that machine. That's cool.
> >
> > -----Original Message-----
> > From: Bert Dawson [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 15, 2001 8:36 AM
> > To: Fusebox
> > Subject: RE: relative directory paths
> >
> >
> > 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\C
> omputerName\
> > 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