|> Home > Documentation > Latest documentation > Interchange configuration > Configuration file and directive syntax|
Configuration file and directive syntax
Configuration directives are usually specified with the directive as the first word on the line, followed by its parameters. Capitalisation of the directive name is not significant. Leading and trailing whitespace is stripped from the line.
Including files in directives
Additional files may be called with an "include file" notation, like this:
Files included from interchange.cfg are relative to the Interchange instance's installation directory. Files included from catalog.cfg are relative to the website's home directory, as defined using the Catalog directive.
For example, a Variable can be initialised from a file like this:
This works well for includes that must be of the highest possible performance. Rather than using a tag, such as [include], the file's content can be simply placed in a page with "__VARIABLE__".
The ConfigDir directive can be used to specify the name of the directory where files will be read from when using the "<file" syntax.
Other configuration files can be included in the current one. For example, common settings can be set in one file:
You can use the following syntax to "include" all files in a named directory, where the filename ends with "tag":
The above would read all files with names like "foo.tag" or "foo.usertag" etc. (if they exist and are readable), and parse the content as an Interchange configuration file. The above would not attempt to open files with names that don't end with "tag", such as "foo.tag.old" etc.
A here document can be used to spread directive values over several lines. The usual Perl "<<MARKER" syntax is used, except that no semicolon is used to terminate the marker. The closing marker must be the only text on the line. No leading or trailing characters are allowed - not even whitespace. Here is a hypothetical directive, defined using the here document syntax:
The above example would be equivalent to the following:
Apache-style container syntax
Configuration directives can be specified using Apache-like syntax. When using this syntax the configuration value will only take effect within the defined block.
This syntax has limited use. The only configuration directive I can think of where this syntax could be useful is ParseVariables. For example:
ifdef and ifndef
ifdef/endif and ifndef/endif pairs can be used to conditionally include/exclude parts of the configuration, as follows: