/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function rel_path($root=NULL) { // Get script name if exists $cur_file = $_SERVER["SCRIPT_NAME"]; // Remove script name // Split at specified root folder if($root != NULL) { $tmp = $tmp[1]; } // Make windows-friendly // Create path array $rel_path = NULL; if ($tmp[$i] != '') { $rel_path .= '../'; } } if ($rel_path != NULL) { } else { $rel_path = '.'; } return $rel_path; }
Comments
