Introduction
  CGI and SSI
  <pike> tag
  Pike script
  Modules
    Module types
    create()
    defvar()
    query()
    set()
    query_internal_location()
    check_variable()
    info()
    query_name()
    register_module()
    start()
    status()
    stop()
    find_internal()
  Parser modules
  Location modules
  Other module types
  Request information object
  Responses
  Library methods
 
defvar()

void defvar( string varname, 
	     mixed value, 
	     string name, 
	     int type,
	     string|void documentation,
	     void|mixed misc,
	     void|int|function(void:int) do_not_show )

The defvar() method is called by the module to register a configuration variable. It is usually called from the constructor (create() method).

varname
is the name used to identify the variable, for example when accessing it with the query() method. Must not begin with a dash (-).

value
the variable's default value. Its type depends of course on the type parameter.

name
the name which will appear in the configuration interface. If the name contains a colon the variable will be shown in a submenu in the configuration interface. The part before the colon will become the name of the submenu, the part after the name shown for this variable.

type
the variable's type. See below for the available types.

documentation
a string documenting this variable.

misc
it has meaning only for some variable types, as discussed in more detail below. If the variable has not one of those types you can set it to 0 or ignore it completely.

do_not_show
is either an integer value or a function. If it is 0 the variable will be shown, if non-zero it will be hidden. The same applies to the return value of the supplied function. The most common use is to hide or show some variables depending on the value of another variable.

Variable Types

TYPE_FLAG
is used to express a true/false variable. The user will be prompted with a yes/no choice, while internally an int will be used to express it.

TYPE_INT
the variable is a integer number.

TYPE_STRING
the variable is a string.

TYPE_FILE
the variable is a path to a file in the real file system. It is stored internally as a string.

TYPE_DIR
the variable is a path to a directory in the real file system. A slash is automatically appended at the end, if not already present, when a new value is set. It is stored internally as a string.

TYPE_DIR_LIST
is a list of directories, stored as an array of strings. Each element is handled in the same way as a TYPE_DIR variable.

TYPE_INT_LIST
is an array of integers.

TYPE_STRING_LIST
is an array of strings.

TYPE_MULTIPLE_INT
the variable will contain an integer, chosen from a choices list. The misc argument is used to supply the list, as an array of integers.

TYPE_MULTIPLE_STRING
the variable will contain a string, chosen from a choices list. The misc argument is used to supply the list, as an array of strings.

TYPE_LOCATION
the variable is a mountpoint in Challenger's virtual file system. It is handled internally as a string.

TYPE_COLOR
the variable is an integer containing a 24-bit RGB color value, coded as red << 16 + green <<8 + blur. The user will be offered a more friendly input format.

TYPE_TEXT
the variable is a string, possibly containing multiple lines of input.

TYPE_PASSWORD
the variable is a password, that will be handled as a string run through unix crypt(). The password will thus not be stored in clear text.

TYPE_FLOAT
the variable is a floating point number.