inbuilt variable for root URL of site?

Is there an inbuilt variable for root URL of a PHPMaker site?
I’m adding links to records when sending email notifications, and I don’t want to hard code the URL in case it changes at any point.

I tried using $RELATIVE_PATH
Is this correct, and if so do I have to call it as a global?

global: $RELATIVE_PATH;

$RELATIVE_PATH is the path of root relative to the page. I’m not sure which “root URL of site” you refer to? If you meant the full URL with the domain name (e.g. protocol://www.mycompany.com/mysite/), there is a function called FullUrl().

FullURL() gives the path to the current page without arguments.
e.g protocol://[mysite]/mytable_list.php

I need the root path of the site.
protocol://[mysite].com

This is so that i can provide links to records in email notifications

Simply put this following code in “Global Code” under “Server Events” → “Global” → “All Pages”:

function AppRootURL() {
return str_replace(substr(strrchr(CurrentUrl(), “/”), 1), “”, DomainUrl().CurrentUrl());
}

then you may call that global function from anywhere in your web application.

Works great - thanks!

philmills wrote:

I need the root path of the site.
protocol://[mysite].com

DomainUrl() alone returns what you need.

arbei wrote:

DomainUrl() alone returns what you need.

Not always. Sometimes, some web applications use the separated sub-folder that owned by each web application under that domain. That’s why you have to get that sub-folder for each web application as its root URL.