|> Home > Documentation > Latest documentation > Local config directives > DirConfig|
Set directives, such as Variable, using files found in a directory.
the directory path will be relative to the website's home directory, as configured using the Catalog directive. The default is "blank" (disabled).
The "directory" name can contain wildcards, such as "*" and "?".
This directive is only available for use in the local (catalog.cfg) configuration file. It will not affect any other website in any way. This directive will not work in the global (interchange.cfg) configuration file.
The first parameter (the directive) is usually Variable, but can practically be any hash-based directive. The second parameter (the directory) is expected to be a filespec that can encompass multiple directories (files are ignored).
The specified directory is scanned for file names that contain only word characters, i.e. something that would be valid as a Variable name. This might make it unsuitable for some other uses, but it helps prevent reading backup files. The contents of the valid files are used to set the Variables (or whatever directive is specified) named after file names.
If the dynamic_variables pragma is set then Variable values will be updated automatically whenever the associated file content changes. The dynamic_variables_file_only pragma restricts dynamic_variables to files only - otherwise variables are dynamically read from the VariableDatabase as well.
With dynamic variables enabled, all "@_VARIABLE_@" and "__VARIABLE__" calls are checked first to see whether their source is a text file. If it is then the file will be read and the value will be returned (even if empty).
Assuming that a file named "STANDARD_TOP" was present in the "templates/regions" directory when the website was last started or reconfigured, a "__STANDARD_TOP__" on any page will act (almost) exactly the same as a call to [include templates/regions/STANDARD_TOP]. I said "almost" because the [include] tag will will allow variables to be parsed and expanded, whereas variables included in DirConfig files will not. See the warning, above.