Hi everyone! Im new here and I have been stumbeling on a quite beginners problem I think.
Im creating a CMS (content management system) and to make it easy for the end user I would like a function that returns a relative path from ex. “k:wwwnfreakpagespage.php” to the file “k:wwwnfreakincludeimageslogo.png”.
The Win-Paths is because I’m using WOSX.
Here you have the recent function code:
[code=php]function MakeRelativePath($Me, $Target)
{
global $INI, $thisFile;
$Me = str_replace(“\”, “/”, $Me);
$Target = str_replace(“\”, “/”, $Target);
echo $Me . “<br>n”;
echo $Target . “<br>n”;
// K:/www/nfreak/index.php
// K:/www/nfreak/include/image/logo.png
$MePath = dirname($Me);
$TargetPath = dirname($Target);
echo $MePath . “<br>n”;
echo $TargetPath . “<br>n”;
// K:/www/nfreak
// K:/www/nfreak/include/image
$MeDir = explode(“/”, $MePath);
$TrgtDir = explode(“/”, $TargetPath);
}
For example, this call (where __FILE
[code=php]$Class->MakeRelativePath(__FILE__, “K:wwwnfreakincludeimagelogo.png”);
Should result in: “...
I need ideas of how I could make it do what I want it to.
Your name will be in the credits for this function If you want.
[SIZE=”1″][I]For those who dont know [B]WOS/WOSX [/B[url]http://wos.chsoftware.net/