var curr = GetBaseTemplatePath();
var rel = Right(newdir,Len(newdir)-3);
var i = 1;
for (i=1; i LT ListLen(curr,'\'); i=i+1)
rel = "..\#rel#";
I use this function any time I am unsure of the path a file is going to be
called from. So say the working directory is C:\wwwroot\somefolder and the
file you want to include is C:\wwwroot\include\myfile.cfm
Just pass C:\wwwroot\include\myfile.cfm into the function, it will always
generate a relative path.
Say you wanted to just get a relative path to the folder, just pass in
Now for the example working folder above you would get back
This function will also work for url references too, with a little trick.
It ignores the first three letters (for file path this is the C:\)
so say you have the webpage www.mysite.com\myfolder\myfile.cfm and an image
You would pass in the **\img the **\ is ignored, and the path passed back is