Index  Previous: MINIVEND.CFG   Next: Configuration Directives in catalog.cfg

CATALOG.CFG

If multiple catalogs are to be run, each must have a catalog.cfg file located in the catalog base directory. It contains most of the configurable parameters for MiniVend -- each is independent from catalog to catalog.

In the catalog configuration file, the directives MailOrderTo and VendURL are required. They are not defined with defaults, and no catalog will operate unless and until they are set with a value.

Many powerful procedures are available in the catalog.cfg file. First, you can set a Variable and use its results in a subsequent configuration setting if ParseVariables is on:

    Variable   SERVER_NAME  www.minivend.com
    Variable   CGI_URL      /cgi-bin/demo
  
    ParseVariables Yes
    VendURL    http://__SERVER_NAME____CGI_URL__
    ParseVariables No

You can define values in multiline form by using the <<HERE document method:

    Variable MYSTUFF <<EOF
        This is my stuff, and I
        am pretty proud of it.
    EOF

As with all here documents, the terminating string must be the ONLY THING ON THE LINE. No leading or trailing characters are allowed, even whitespace.

Include single setting from file

You can pull a value from a file with <file:

    Variable MYSTUFF <file

This works well for includes that must be of the highest possible performance -- they can be simply placed in a page with __VARIABLE__.

Include multiple settings from file

You can set common settings in one file:

    #include common.cfg

Or all files in one directory

    #include usertag/*
  • You can use #ifdef / #endif and #ifndef / #endif pairs:

        Variable ORDERS_TO email_address
      
        #ifdef ORDERS_TO
        ParseVariables Yes
        MailOrderTo __ORDERS_TO__
        ParseVariables No
        #endif
      
        #ifdef ORDERS_TO =~ /foo.com/
        # Send all orders at foo.com to one place now
        # Set ORDERS_TO to stop default setting
        Variable  ORDERS_TO  1
        MailOrderTo   orders@foo.com
        #endif
      
        #ifdef ORDERS_TO eq 'nobody@nowhere.com'
        # Better change to something else, set ORDERS_TO to stop default
        Variable  ORDERS_TO  1
        MailOrderTo   someone@somewhere.com
        #endif
      
        #ifndef ORDERS_TO
        #Needs to go somewhere....
        MailOrderTo  webmaster@localhost
        #endif
    
    Define subroutine watches

    You can set up almost any configuration variable to be tied to a subroutine if you have the Tie::Watch module installed. It uses a notation like the << HERE document, but <&HERE is the notation. See MiniVend Programming for details.




  • Index  Previous: MINIVEND.CFG   Next: Configuration Directives in catalog.cfg