Replying to the whole thread,

Tyler said:

>Sorry to break it to you, but I don't that's achievable.
>
>
>You can get the root of CF by calling an empty ExpandPath():
>
>#ExpandPath("")#
>
>
>But that just gives you ColdFusion's root, which isn't necessarily going to
>be your web server root.

#ExpandPath("")#

Will give an error but

#ExpandPath("*.*")#

will give the absolute path from the root directory of the drive to where the function was called, not CF's root or the webserver root.

>IMO, the best thing to do to handle general location-ing(?) is to create a
>root mapping yourself.  

Agreed

>Make a mapping called "/" that points to the web
>server root, then everything should fall into place after that.  If you are
>on a hosted server, kindly ask the admins to create one for you, or create a
>more specific mapping for each site of yours.  If they can't do either of
>these very basic, necessary tasks...dump 'em, there are plenty of shared
>hosting providers out there that will.

And what if many users on one server want the "/" mapping for themselves?

We suggest a short and unique mapping (to avoid confusion) for each user's site and that the developer uses it, preferably as a variable, for both their dev and hosting setups. EG

mapping /mbc/  to /site/webroot/ in CF Admin

<cfset request.CFmap = "/mbc/"> in application.cfm or somewhere relevant

and in the code:

<cfinclude template="#request.CFmap#test.cfm">

>Other than with a mapping, CF has no idea what the root of your web server
>is.  I've searched long and hard, there's just no definitive
>variable/function out there->

harking bak to the original question I wonder what was meant by "root for my web server" as it is a bit ambiguous?  The root directory for a specific website is discoverable by the expandpath() function mentioned above, the web server's root could be a totally different place.

-

Yours,

Kym
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to