--- a/include/Util.class.php +++ b/include/Util.class.php @@ -144,5 +144,18 @@ return $files; } + /** + * Get the base install url (without index) + * + * @return string base url + */ + public static function BaseUrl() + { + $baseurl = $_SERVER['SCRIPT_NAME']; + if (substr_compare($baseurl, '.php', -4) === 0) + $baseurl = dirname($baseurl); + return rtrim($baseurl, "/"); + } + }