Difference between revisions of "WHMCS Base URL Template Variable"

From WHMCS Documentation

(Created page with "The WHMCS Base URL must be defined in all client side template files for javascript ajax calls to function correctly. If this variable is not defined in your active system te...")
(No difference)

Revision as of 14:11, 17 April 2018

The WHMCS Base URL must be defined in all client side template files for javascript ajax calls to function correctly.

If this variable is not defined in your active system template then you will see a warning notice in the browser console as follows:

Warning: The WHMCS Base URL definition is missing from your active template. Please refer to https://docs.whmcs.com/WHMCS_Base_URL_Template_Variable for more information and details of how to resolve this warning.

To resolve this warning, you must add the following to the <head> section of your template:

<script> var whmcsBaseUrl = "{\WHMCS\Utility\Environment\WebHelper::getBaseUrl()}"; </script>

It is important that this variable is defined before the templates scripts.min.js file is included.

By default, the Six template defines this parameter within the /includes/head.tpl template file along with a number of other required javascript variables.

You can refer to https://github.com/WHMCS/templates-six/blob/master/includes/head.tpl for a copy of the latest version of the head.tpl template file.