I didn't see the original post, so I'm jumping in the middle.

At 08:15 AM 09/25/2001 -0700, you wrote:
>What I am wanting is a relative path but relative to the web root...for
>portability.
>
>I have an include file that I want to include by specifying the same path
>every time in all files in the hierarchy.  So I put this include file in
>/global directory and want to reference it by "/global/foo.cfm", which if it
>worked, would be the same include line in all files in my web site.  But
>this path does not work for includes.

  The way I do this is by setting a variable ( Either to the local scope or 
the request scope ) in the application.cfm called DirLevel:

Root:             Dirlevel = ""
  Sub1            Direvel = "../"
   SubSub1:    Dirlevel = "../../"
  Sub2            Dirlevel = "../


  When you create your include, make all the paths relative to the root 
directory and add dirlevel in there.

<A HREF="#dirlevel#index.cfm">Home</A>
<A HREF="#dirlevel#sub1/page1.cfm">Page 1</A>
etc.. etc..

  This makes it easy, and I do it all the time.
  One potential problem is that you'll need different application.cfm for 
each directory.


>I have tried a variety of absolute paths and find none that work.  If anyone
>can shed some light on this...my host shares the CF server so asking them to
>configure a mapping for "/" is not going to happen since it would only work
>for my domain and not for all the other domains they host.

   You can always get to the exact root directory (I.E. www.mysite.com/ ) 
by using the slash.  So the code I wrote above could easily be re-written like:

<A HREF="/index.cfm">Home</A>
<A HREF="/sub1/page1.cfm">Page 1</A>

  And the browser sees the '/' and automatically adds it to the end of the 
url, such as www.mysite.com/index.cfm for the first link.  Try it; It 
works.  However, if the root directory of your application is not the root 
directory of your server, that won't work.



--
Jeffry Houser | mailto:[EMAIL PROTECTED]
AIM: Reboog711  | ICQ: 5246969 | Fax / Phone: 860-223-7946
--
I'm looking for a room-mate in the Hartford CT area, starting in October
--
DotComIt: Database Driven Web Data
My Book: Instant ColdFusion 5.0  | http://www.instantcoldfusion.com
--
Far Cry Fly, Alternative Folk Rock
http://www.farcryfly.com | http://www.mp3.com/FarCryFly
--
A friend is someone who knows how to spell your name.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to