$path = $_SERVER['PHP_SELF']; $page = basename($path); $page = basename($path, '.php'); $dir = substr(strrchr(getcwd(), '/'), 1); ?>