Originariamente inviato da piero.mac
...
:ignore:


Codice PHP:
function relPath() {
    
// returns the relative folder-path of the current file 
    
$filePath explode("/",  str_replace("\\\", "/", $_SERVER['PHP_SELF']));
    array_pop(
$filePath);
    return implode("
/", $filePath);
}

function relRoot() {
    // returns the relative folder-path of the root 
    
$relRoot = "";
    
$filePath = explode("/",  str_replace("\\\", "/", $_SERVER['PHP_SELF']));
    for (
$i = 0; $i < count($filePath) - 2; $i++) {
        
$relRoot .= "../";
    }
    return 
$relRoot;