[ic] Did you know about VariableDatabase and site.txt? (Part of a series)

Mike Heins mike at perusion.com
Sun May 8 11:05:12 EDT 2005


Interchange has the Variable directive that allows you to set strings
in your configuration and use them with __VARIABLE_NAME__ and other
notations in your pages. But did you know you can keep these strings
in a database and have multiple levels of setting?

The standard and foundation catalog each have a line you may have seen
in the catalog.cfg:

    VariableDatabase site

This looks for a database table named "site", and tries to read variable
values from it. If the table does not exist, it looks for a site.txt
file in the ProductDir (products) directory and creates it from that.

The columns used are the key column (usually "code") and the Variable
column. To make settings, you simply create a tab-delimited file:

    code                Variable
    CGI_URL             /cgi-bin/devel
    SERVER_NAME         yourhost.yourdomain.com
    SECURE_SERVER       https://yourhost.yourdomain.com

This will be sufficient to change the URL for your catalog from
the values set up in variable.txt.

Since this call is after the "VariableDatabase variable" call which
builds the familiar preferences and variable.txt database, it has the
effect of overriding its settings.

One common use of site.txt is as a temporary override to the settings
for a catalog, perhaps for a development or test version. Another
use would be for a very standard catalog which you which to personalize
or change in a minor fashion for deployment.

Careful, though! These settings override the ones in variable.txt
and the UI preferences, and you have to remember that.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer


More information about the interchange-users mailing list