mgd_get_current_host_prefix()

This function returns the site-global URL Prefix. Prepend this string to every absoute URL you build and you won't have Problems with changing the prefix-settint in your Midgard Host Record.

This function only returns the host's prefix. We're not sure yet, if there are any conditions where you'd require the complete link prefix including the protocol specifier and the FQDN.

Code

<?php

function mgd_get_current_host_prefix() {
   
$midgard = mgd_get_midgard();
   
$midgard_host = mgd_get_host($midgard->host);
   if (!
$midgard_host) return false;

   return
$midgard_host->prefix;
}

?>