<cfscript>
dir = getDirectoryFromPath(getCurrentTemplatePath());
dir = listLast(dir, "\/");
</cfscript>

The first line basically does an expandPath('.'), but relative to the
current template, rather than the root template for the request.  The second
line gets the last part of the directory, using the slash and backslash as
delimiters, so it'll work on windows or *nix.

Cheers,
barneyb

> -----Original Message-----
> From: Bob Haroche [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 21, 2004 11:18 AM
> To: CF-Talk
> Subject: Determining Directory Where Current Template Is Located
>
> I've done this before but of course now I can't remember how...
>
> I have a template located at:
>
> f:\wwwroot\client\myDirectory\template.cfm
>
> I need to extract just the name of the directory holding the
> template -- ie, "myDirectory".  And I need to do this in such a way
> that the CFML doesn't rely on hard coding  "f:\", "wwwroot" or
> "client" as copies of this template will reside in different locations
> on different servers.
>
> Ideas? Thanks.
>
> -------------
> Regards,
> Bob Haroche
> O n P o i n t  S o l u t i o n s
> www.OnPointSolutions.com
>
>
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to