• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dynamically finding the web root

Participant ,
Mar 10, 2007 Mar 10, 2007

Copy link to clipboard

Copied

I am trying to make one of my applications truely dynamic so far as reading the xml configuration file. The configuration file is in my web root (config.cfm) this file is merely an XML file wrapped in comment tags to prevent anyone from seeing it if they browse it directly. There is also another file in the web root called findpath.cfm. Find path contains ExpandPath("*.*) which I am hoping to use to capture and save a variable with the physical path. The physical path to both of those files is C:\CFusionMX\wwwroot\opiax

Well here is my question. Let's say I want to dynamically find the path to those files from this directory C:\CFusionMX\wwwroot\opiax\_admin in my application.cfm

How could I do that using ColdFusion MX 6.1?

TOPICS
Advanced techniques

Views

265

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Mar 10, 2007 Mar 10, 2007
I figured it out. Move my config file to it's own folder and figure out where I am.
<!--- Find root directory --->
<cfset rootDir = getDirectoryFromPath(getCurrentTemplatePath())>
<!---Then do a replace--->
<cfset rootDir = replace(rootDir, "_admin","config")>

Votes

Translate

Translate
Participant ,
Mar 10, 2007 Mar 10, 2007

Copy link to clipboard

Copied

LATEST
I figured it out. Move my config file to it's own folder and figure out where I am.
<!--- Find root directory --->
<cfset rootDir = getDirectoryFromPath(getCurrentTemplatePath())>
<!---Then do a replace--->
<cfset rootDir = replace(rootDir, "_admin","config")>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation