|
home / documentation / reference / hm_configdir
HM_ConfigDir
- Description:
- The server directory (folder) where your user-defined HierMenus
configuration files are stored.
- Value:
- String, empty string (""), or JavaScript expression that returns a
String/empty string.
- Applies To:
- Globally.
- Browser Compatibility:
- HM_ConfigDir is supported in all browsers.
- Comments:
- HM_ConfigDir is the server directory, specified as a valid
URL, of the location on your Web server where your user defined configuration files
are stored. This may be the same directory as your scripts and/or images or a different
directory altogether per your discretion. We recommend storing your configuration
files separately from your scripts and images.
HM_ConfigDir is a global variable that is set in the HM_Loader.js
file. It is not set in the configuration file as other
configuration parameters are, which explains why it is set using a standard JavaScript
assignment statement (via the = sign). The reason for
this is because HierMenus needs to know the value of HM_ConfigDir
before the configuration files themselves are loaded. See the examples below.
When set to something other than the empty string (""),
HM_ConfigDir must always end with a trailing slash (/).
If HM_ConfigDir is set to the empty string, as it is by
default, then HierMenus will assume that your configuration files (the names of which
are specified in HM_ConfigFiles) exist in the same directory
that the HTML page that is calling them is in. This means that, with HM_ConfigDir
set to the empty string you would need to place copies of your configuration files
in each directory of your server (or at the very least, each directory that contains an
HTML page that will be displaying menus). This approach is not advised.
Rather, you should create a a single directory on your server where all your configuration
files will be stored, and then set HM_ConfigDir to point to that directory.
If you use an absolute (including the domain name) or root-relative (beginning with a
slash) pathname in HM_ConfigDir, then HierMenus will be able to properly find
the files no matter where the HTML page that loads them is. For example, assuming
your domain is called www.mydomain.com and you've stored the configuration
files in a folder in your Web document root called hm/configs, then
either of these settings for HM_ConfigDir is recommended:
HM_ConfigDir="http://www.mydomain.com/hm/configs/";
HM_ConfigDir="/hm/configs/";
Note how the configuration parameter setting HM_ConfigDir interacts
with the HM_ConfigFiles parameter. HM_ConfigFiles is
always added to the front of each configuration file specified
in HM_ConfigFiles to arrive at the actual server location for
each file. For example, given these two settings:
HM_ConfigFiles="config1.js,config2.js";
HM_ConfigDir="http://mydomain.com/hm/configs/";
HierMenus would attempt to retrieve these two files from the server
http://mydomain.com/hm/configs/config1.js
http://mydomain.com/hm/configs/config2.js
In the HM_Loader.js file, you may note that the default setting for
HM_ConfigDir looks a little cryptic:
if(typeof(window.HM_ConfigDir)=="undefined")
HM_ConfigDir = "";
Though admittedly verbose, setting the parameter in this manner (with the if...
logic on the line just prior to the setting of the actual parameter) allows you
to override this setting on a page by page basis if you should choose to do so at
a later time. i.e., The logic above basically says "if HM_ConfigDir is not
already set, set it now." If you know that you will never be overridding HM_ConfigDir
on any of your pages, then you can remove the if... line that precedes the
HM_ConfigDir setting. We recommend, however, that you leave it as is so that
you can take advantage of the feature at a later time if need be.
- Examples:
// Ok:
HM_ConfigDir = "http://mydomain.com/hm/configs/",
HM_ConfigDir = "/hm/configs/", // Web server root relative address
HM_ConfigDir = "myconfig/", // relative to page (not recommended)
HM_ConfigDir = "", // same as page (not recommended)
HM_ConfigDir = (window.useVerbose)?"/hm/confvb/":"/hm/confopt/",
// if the user defined variable "useVerbose" is true,
// then use the scripts located in "/hm/confvb/";
// otherwise use the scripts located in "/hm/confopt/"
// Incorrect:
HM_ConfigDir = http://mydomain.com/hm/configs/,
// strings must be quoted
HM_ConfigDir = " ",
// no spaces allowed in the empty string
HM_ConfigDir : "http://mydomain.com/hm/configs/",
// must use = sign (not colon)
HM_ConfigDir = '(window.useVerbose)?"/hm/confvb/":"/hm/confopt/"',
// no quoted expressions
- Default:
- ""
- See Also:
-
HM_ScriptDir,
HM_ConfigFiles,
HM_ConfigType,
HM_FramesEnabled,
HM_ImageDir
|